コード例 #1
0
ファイル: BelongsToMany.php プロジェクト: kalvisbuls/analogue
 /**
  * Add the constraints for a relationship count query.
  *
  * @param  \Analogue\ORM\Query $query
  * @param  \Analogue\ORM\Query $parent
  * @return \Analogue\ORM\Query
  */
 public function getRelationCountQuery(Query $query, Query $parent)
 {
     if ($parent->getQuery()->from == $query->getQuery()->from) {
         return $this->getRelationCountQueryForSelfJoin($query, $parent);
     }
     $this->setJoin($query);
     return parent::getRelationCountQuery($query, $parent);
 }
コード例 #2
0
ファイル: Query.php プロジェクト: maxmirazh33/analogue
 /**
  * Merge the "wheres" from a relation query to a has query.
  *
  * @param  \Analogue\ORM\System\Query  $hasQuery
  * @param  \Analogue\ORM\Relationships\Relationship  $relation
  * @return void
  */
 protected function mergeWheresToHas(Query $hasQuery, Relationship $relation)
 {
     // Here we have the "has" query and the original relation. We need to copy over any
     // where clauses the developer may have put in the relationship function over to
     // the has query, and then copy the bindings from the "has" query to the main.
     $relationQuery = $relation->getBaseQuery();
     $hasQuery->mergeWheres($relationQuery->wheres, $relationQuery->getBindings());
     $this->query->mergeBindings($hasQuery->getQuery());
 }