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


PHP EntityManager::getFilters方法代码示例

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


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

示例1: generateFilterConditionSQL

 /**
  * Generates the filter SQL for a given entity and table alias.
  *
  * @param ClassMetadata $targetEntity Metadata of the target entity.
  * @param string $targetTableAlias The table alias of the joined/selected table.
  *
  * @return string The SQL query part to add to a query.
  */
 private function generateFilterConditionSQL(ClassMetadata $targetEntity, $targetTableAlias)
 {
     if (!$this->em->hasFilters()) {
         return '';
     }
     switch ($targetEntity->inheritanceType) {
         case ClassMetadata::INHERITANCE_TYPE_NONE:
             break;
         case ClassMetadata::INHERITANCE_TYPE_JOINED:
             // The classes in the inheritance will be added to the query one by one,
             // but only the root node is getting filtered
             if ($targetEntity->name !== $targetEntity->rootEntityName) {
                 return '';
             }
             break;
         case ClassMetadata::INHERITANCE_TYPE_SINGLE_TABLE:
             // With STI the table will only be queried once, make sure that the filters
             // are added to the root entity
             $targetEntity = $this->em->getClassMetadata($targetEntity->rootEntityName);
             break;
         default:
             //@todo: throw exception?
             return '';
             break;
     }
     $filterClauses = array();
     foreach ($this->em->getFilters()->getEnabledFilters() as $filter) {
         if ('' !== ($filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias))) {
             $filterClauses[] = '(' . $filterExpr . ')';
         }
     }
     return implode(' AND ', $filterClauses);
 }
开发者ID:bardascat,项目名称:blogify,代码行数:41,代码来源:SqlWalker.php

示例2: makeBlockShared

 /**
  * Makes a block shared and creates a pointer block in it's place
  *
  * This method performs the change and persists/flushes to the database.
  *
  * @param integer $id
  * @param integer $rootVersion
  *
  * @return BlockPointer
  */
 public function makeBlockShared($id)
 {
     if ($this->em->getFilters()->isEnabled('draftversion')) {
         $this->em->getFilters()->disable('draftversion');
     }
     $block = $this->find($id);
     $version = $this->getNewVersion($block);
     // Duplicate some of the settings to the pointer
     $pointer = new PointerBlock();
     $pointer->setOwner($block->getOwner());
     $pointer->setParent($block->getParent());
     $pointer->setReference($block);
     $pointer->setRootVersion($version);
     // Detach and make shared
     $block->setShared(true);
     $block->setParent(null);
     $block->setOwner(null);
     $block->setPosition(0);
     $block->setSort(0);
     $block->setRootVersion($version);
     $this->killLoggableListener();
     $this->save($block)->save($pointer);
     return $pointer;
 }
开发者ID:RobertjanSchipper,项目名称:Cms,代码行数:34,代码来源:BlockManager.php


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