addJoin() public static method

Adds a join clause to the given query for the given schema and relationship. Optionally takes a nested list of relationships that will be recursively joined as needed.
public static addJoin ( $query, $parentAlias, $schema, $relName, $nested = [], $joinType = 'inner' ) : void
return void
Beispiel #1
0
 /**
  * Join other related objects into a collection for the purpose of filtering. Relationships
  * is either a flat array of relationships (as defined in the object's schema) or a nested array
  * @chainable
  */
 public function join($rels, $joinType = 'inner')
 {
     $schemaAlias = $this->_schema->alias();
     foreach (Relationship::normalizeMap($rels) as $alias => $nested) {
         Relationship::addJoin($this->_queryForWrite(), $schemaAlias, $this->_schema, $alias, $nested, $joinType);
     }
     return $this;
 }