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


PHP QueryObject::setBaseEntity方法代码示例

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


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

示例1: getBy

 public function getBy(QueryObject $query)
 {
     $class = $this->entity_class;
     $query->setBaseEntity(new $class());
     $filter = (string) $query;
     $do = $class::get()->where($filter);
     $joins = $query->getAlias();
     foreach ($joins as $table => $clause) {
         $do = $do->innerJoin($table, $clause);
     }
     if (count($query->getOrder())) {
         $do = $do->sort($query->getOrder());
     }
     if (is_null($do)) {
         return false;
     }
     $entity = $do->first();
     $this->markEntity($entity);
     return $entity;
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:20,代码来源:SapphireRepository.php

示例2: getBy

 public function getBy(QueryObject $query)
 {
     $class = $this->entity_class;
     $query->setBaseEntity(new $class());
     $filter = (string) $query;
     $do = $class::get()->where($filter);
     foreach ($query->getAlias(QueryAlias::INNER) as $spec) {
         $do = $do->innerJoin($spec->getTable(), $spec->getCondition(), $spec->getAlias());
     }
     foreach ($query->getAlias(QueryAlias::LEFT) as $spec) {
         $do = $do->leftJoin($spec->getTable(), $spec->getCondition(), $spec->getAlias());
     }
     if (count($query->getOrder())) {
         $do = $do->sort($query->getOrder());
     }
     if (is_null($do)) {
         return false;
     }
     $entity = $do->first();
     $this->markEntity($entity);
     return $entity;
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:22,代码来源:SapphireRepository.php

示例3: getBy

 public function getBy(QueryObject $query)
 {
     $class = $this->entity_class;
     $query->setBaseEntity(new $class());
     $filter = (string) $query;
     $do = $class::get()->where($filter);
     $joins = $query->getAlias();
     foreach ($joins as $table => $clause) {
         $do = $do->innerJoin($table, $clause);
     }
     if (count($query->getOrder())) {
         $do = $do->sort($query->getOrder());
     }
     if (is_null($do)) {
         return false;
     }
     $entity = $do->first();
     if (!is_null($entity) && $entity instanceof IEntity) {
         UnitOfWork::getInstance()->setToCache($entity);
         UnitOfWork::getInstance()->scheduleForUpdate($entity);
     }
     return $entity;
 }
开发者ID:rbowen,项目名称:openstack-org,代码行数:23,代码来源:SapphireRepository.php


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