コード例 #1
0
 /**
  * @param $fromTable
  * @param RelationWithAlias[] $relationWithAliases
  * @param $type
  * @param $on
  * @return ModelJoin[]
  */
 public static function createModelJoins($fromTable, $relationWithAliases, $type, $on)
 {
     $result = array();
     $field = '';
     $table = $fromTable;
     $fetch = true;
     foreach ($relationWithAliases as $relationWithAlias) {
         $relation = $relationWithAlias->relation;
         $field = $field ? $field . '->' . $relation->getName() : $relation->getName();
         $fetch = $fetch && !$relation->isCollection();
         $modelJoin = new ModelJoin($field, $table, $relation, $relationWithAlias->alias, $type, $on, $fetch);
         $table = $modelJoin->alias();
         $result[] = $modelJoin;
     }
     return $result;
 }
コード例 #2
0
ファイル: ModelQueryBuilder.php プロジェクト: letsdrink/ouzo
 private function isAlreadyJoined(ModelJoin $modelJoin)
 {
     return Arrays::any($this->_joinedModels, ModelJoin::equalsPredicate($modelJoin));
 }