当前位置: 首页>>代码示例>>PHP>>正文


PHP SelectQuery::hasJoinedTable方法代码示例

本文整理汇总了PHP中SelectQuery::hasJoinedTable方法的典型用法代码示例。如果您正苦于以下问题:PHP SelectQuery::hasJoinedTable方法的具体用法?PHP SelectQuery::hasJoinedTable怎么用?PHP SelectQuery::hasJoinedTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SelectQuery的用法示例。


在下文中一共展示了SelectQuery::hasJoinedTable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: joinHelperTable

 /**
  * @return SelectQuery
  **/
 protected function joinHelperTable(SelectQuery $query)
 {
     $uc = $this->container;
     if (!$query->hasJoinedTable($uc->getHelperTable())) {
         $query->join($uc->getHelperTable(), Expression::eq(new DBField($uc->getParentTableIdField(), $uc->getDao()->getTable()), new DBField($uc->getChildIdField(), $uc->getHelperTable())));
     }
     return $query->andWhere(Expression::eq(new DBField($uc->getParentIdField(), $uc->getHelperTable()), new DBValue($uc->getParentObject()->getId())));
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:11,代码来源:ManyToManyLinkedWorker.class.php

示例2: joinProperties

 private function joinProperties(SelectQuery $query, ProtoDAO $parentDao, $parentTable, $parentRequired, $prefix = null)
 {
     $proto = call_user_func(array($parentDao->getObjectName(), 'proto'));
     foreach ($proto->getPropertyList() as $property) {
         if ($property instanceof LightMetaProperty && $property->getRelationId() == MetaRelation::ONE_TO_ONE && !$property->isGenericType() && (!$property->getFetchStrategyId() && $this->getFetchStrategy()->getId() == FetchStrategy::JOIN || $property->getFetchStrategyId() == FetchStrategy::JOIN)) {
             if (is_subclass_of($property->getClassName(), 'Enumeration')) {
                 // field already added by makeSelectHead
                 continue;
             } elseif ($property->isInner()) {
                 $proto = call_user_func(array($property->getClassName(), 'proto'));
                 foreach ($proto->getPropertyList() as $innerProperty) {
                     $query->get(new DBField($innerProperty->getColumnName(), $parentTable));
                 }
                 continue;
             }
             $propertyDao = call_user_func(array($property->getClassName(), 'dao'));
             // add's custom dao's injection possibility
             if (!$propertyDao instanceof ProtoDAO) {
                 continue;
             }
             $tableAlias = $propertyDao->getJoinName($property->getColumnName(), $prefix);
             $fields = $propertyDao->getFields();
             if (!$query->hasJoinedTable($tableAlias)) {
                 $logic = Expression::eq(DBField::create($property->getColumnName(), $parentTable), DBField::create($propertyDao->getIdName(), $tableAlias));
                 if ($property->isRequired() && $parentRequired) {
                     $query->join($propertyDao->getTable(), $logic, $tableAlias);
                 } else {
                     $query->leftJoin($propertyDao->getTable(), $logic, $tableAlias);
                 }
             }
             foreach ($fields as $field) {
                 $query->get(new DBField($field, $tableAlias), $propertyDao->getJoinPrefix($property->getColumnName(), $prefix) . $field);
             }
             $this->joinProperties($query, $propertyDao, $tableAlias, $property->isRequired() && $parentRequired, $propertyDao->getJoinPrefix($property->getColumnName(), $prefix));
         }
     }
 }
开发者ID:rero26,项目名称:onphp-framework,代码行数:37,代码来源:Criteria.class.php


注:本文中的SelectQuery::hasJoinedTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。