public static function createOrUpdateGraphNode($data)
    {
        // @todo this will be GraphNode soon
        if ($data instanceof GraphObject || $data instanceof GraphNode) {
            $data = array_dot($data->asArray());
        }

        $data = static::convertGraphNodeDateTimesToStrings($data);

        if (! isset($data['id'])) {
            throw new \InvalidArgumentException('Graph node id is missing');
        }

        $attributes = [static::getGraphNodeKeyName() => $data['id']];

        $graph_node = static::firstOrNewGraphNode($attributes);

        static::mapGraphNodeFieldNamesToDatabaseColumnNames($graph_node, $data);

        $graph_node->save();

        return $graph_node;
    }
public static function createOrUpdateGraphNode($data)
    {
        // @todo this will be GraphNode soon
        if ($data instanceof GraphObject || $data instanceof GraphNode) {
            $data = array_dot($data->asArray());
        }

        $data = static::convertGraphNodeDateTimesToStrings($data);

        if (! isset($data['id'])) {
            throw new \InvalidArgumentException('Graph node id is missing');
        }

        $attributes = [static::getGraphNodeKeyName() => $data['id']];

        $graph_node = static::firstOrNewGraphNode($attributes);

        static::mapGraphNodeFieldNamesToDatabaseColumnNames($graph_node, $data);

        $graph_node->save();

        return $graph_node;
    }
public static function createOrUpdateGraphNode ( $ data ) { // @todo this will be GraphNode soon if ( $ data instanceof GraphObject || $ data instanceof GraphNode ) { $ data = array_dot ( $ data -> asArray ( ) ) ; } $ data = static :: convertGraphNodeDateTimesToStrings ( $ data ) ; if ( ! isset ( $ data [ 'id' ] ) ) { throw new \ InvalidArgumentException ( 'Graph node id is missing' ) ; } $ attributes = [ static :: getGraphNodeKeyName ( ) => $ data [ 'id' ] ] ; $ graph_node = static :: firstOrNewGraphNode ( $ attributes ) ; static :: mapGraphNodeFieldNamesToDatabaseColumnNames ( $ graph_node , $ data ) ; $ graph_node -> save ( ) ; return $ graph_node ; }
Inserts or updates the Graph node to the local database

@param array|GraphObject|GraphNode $data

@return Model

@throws \InvalidArgumentException
Inserts or updates the Graph node to the local database