Example #1
0
 /**
  * Convert a model to a Node object.
  *
  * @param  \Sgpatil\Orientdb\Eloquent\Model $model
  * @return \\Orientdb\Node
  */
 public function asNode(Model $model)
 {
     $node = $this->client->makeNode();
     // If the key name of the model is 'id' we will need to set it properly with setId()
     // since setting it as a regular property with setProperty() won't cut it.
     if ($model->getKeyName() == 'id') {
         $node->setId($model->getKey());
     } else {
         $node->setProperty($model->getKeyName(), $model->getKey());
     }
     return $node;
 }