コード例 #1
0
ファイル: BelongsTo.php プロジェクト: kalvisbuls/analogue
 /**
  * Add the constraints for a relationship count query.
  *
  * @param  \Analogue\ORM\System\Query $query
  * @param  \Analogue\ORM\System\Query $parent
  * @return \Analogue\ORM\System\Query
  */
 public function getRelationCountQuery(Query $query, Query $parent)
 {
     $query->select(new Expression('count(*)'));
     $otherKey = $this->wrap($query->getTable() . '.' . $this->otherKey);
     return $query->where($this->getQualifiedForeignKey(), '=', new Expression($otherKey));
 }