Example #1
0
 /**
  * Add a relationship MATCH clause to the query.
  *
  * @param  \Sgpatil\Orientdb\Eloquent\Model $parent       The parent model of the relationship
  * @param  \Sgpatil\Orientdb\Eloquent\Model $related      The related model
  * @param  string $relatedNode  The related node' placeholder
  * @param  string $relationship The relationship title
  * @param  string $property     The parent's property we are matching against
  * @param  string $value
  * @param  string $direction Possible values are in, out and in-out
  * @return \Sgpatil\Orientdb\Query\Builder|static
  */
 public function matchRelation($parent, $related, $relatedNode, $relationship, $property, $value = null, $direction = 'out')
 {
     $parentLabels = $parent->getTable();
     $relatedLabels = $related->getTable();
     $parentNode = $this->modelAsNode($parentLabels);
     $this->matches[] = array('type' => 'Relation', 'property' => $property, 'direction' => $direction, 'relationship' => $relationship, 'parent' => array('node' => $parentNode, 'labels' => $parentLabels), 'related' => array('node' => $relatedNode, 'labels' => $relatedLabels));
     $this->addBinding(array($this->wrap($property) => $value), 'matches');
     return $this;
 }