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


PHP EntityManagerInterface::getFilters方法代码示例

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


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

示例1: enable

 /**
  * That nested case will be corrected and fully supported
  * {% softdeleteable %}
  *    <span>
  *       {% softdeleteable 'Acme\Bundle\CoreBundle\Entity\Foo' %}
  *           {% softdeleteable %}
  *               {% softdeleteable 'Acme\Bundle\CoreBundle\Entity\Bar' %}
  *                   {{ object.owner.fullName }}
  *               {% endsoftdeleteable %}
  *           {% endsoftdeleteable %}
  *       {% endsoftdeleteable %}
  *    </span>
  * {% endsoftdeleteable %}
  * @param null $class
  * @return bool
  */
 public function enable($class = null)
 {
     if (!$this->entityManager->getFilters()->isEnabled('softdeleteable')) {
         if ($class !== null) {
             // Nested tags case.
             // {% softdeleteable 'FQCN' %} inside {% softdeleteable %}
             // So, just pop classes stack
             $this->classStack->pop();
         } else {
             // When we enable globally we need to restore disabled entities
             $this->entityManager->getFilters()->enable('softdeleteable');
             // Populate from stack of disabled entities
             /** @var SoftDeleteableFilter $filter */
             $filter = $this->entityManager->getFilters()->getFilter('softdeleteable');
             foreach ($this->classStack as $class) {
                 $filter->disableForEntity($class);
             }
         }
     } else {
         if ($class !== null) {
             /** @var SoftDeleteableFilter $filter */
             $filter = $this->entityManager->getFilters()->getFilter('softdeleteable');
             $filter->enableForEntity($class);
             $this->classStack->pop();
         }
     }
 }
开发者ID:korotovsky,项目名称:gedmo-twig-softdeleteable-bundle,代码行数:43,代码来源:TwigSoftdeleteableExtension.php

示例2: onKernelRequest

 /**
  * Enables tenantable filter on kernel.request.
  */
 public function onKernelRequest()
 {
     $tenant = $this->tenantContext->getTenant();
     if ($tenant && $tenant->getId()) {
         $this->entityManager->getFilters()->enable('tenantable')->setParameter('tenantCode', $tenant->getCode());
     }
 }
开发者ID:superdesk,项目名称:web-publisher,代码行数:10,代码来源:TenantableListener.php

示例3: isUsedCode

 /**
  * @param string $token
  *
  * @return Boolean
  */
 protected function isUsedCode($token)
 {
     $this->manager->getFilters()->disable('softdeleteable');
     $isUsed = null !== $this->repository->findOneBy(array('confirmationToken' => $token));
     $this->manager->getFilters()->enable('softdeleteable');
     return $isUsed;
 }
开发者ID:Strontium-90,项目名称:Sylius,代码行数:12,代码来源:TokenProvider.php

示例4: generateUniqueToken

 /**
  * {@inheritDoc}
  */
 public function generateUniqueToken()
 {
     $this->manager->getFilters()->disable('softdeleteable');
     do {
         $token = $this->generator->generate($this->tokenLength);
     } while ($this->isUsedCode($token));
     $this->manager->getFilters()->enable('softdeleteable');
     return $token;
 }
开发者ID:sidibea,项目名称:Sylius,代码行数:12,代码来源:TokenProvider.php

示例5: generateUniqueCode

 /**
  * {@inheritdoc}
  */
 public function generateUniqueCode()
 {
     $this->manager->getFilters()->disable('softdeleteable');
     do {
         $hash = sha1(microtime(true));
         $code = strtoupper(substr($hash, mt_rand(0, 33), 6));
     } while ($this->isUsedCode($code));
     $this->manager->getFilters()->enable('softdeleteable');
     return $code;
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:13,代码来源:CouponGenerator.php

示例6: bootExtension

 /**
  * @param Extension $extension
  */
 public function bootExtension(Extension $extension)
 {
     $extension->addSubscribers($this->evm, $this->em, $this->reader);
     if (is_array($extension->getFilters())) {
         foreach ($extension->getFilters() as $name => $filter) {
             $this->metadata->addFilter($name, $filter);
             $this->em->getFilters()->enable($name);
         }
     }
 }
开发者ID:vyolla,项目名称:orm,代码行数:13,代码来源:ExtensionManager.php

示例7: getSource

 /**
  * {@inheritdoc}
  */
 public function getSource()
 {
     $this->entityManager->getFilters()->disable('archivable');
     $source = new Entity('CSBillInvoiceBundle:Invoice');
     /** @var InvoiceRepository $repo */
     $repo = $this->entityManager->getRepository('CSBillInvoiceBundle:Invoice');
     $queryBuilder = $repo->createQueryBuilder('i');
     $queryBuilder->where('i.archived is not null');
     $source->initQueryBuilder($queryBuilder);
     return $source;
 }
开发者ID:Codixis,项目名称:CSBill,代码行数:14,代码来源:InvoiceArchivedGrid.php

示例8: getSource

 /**
  * {@inheritdoc}
  */
 public function getSource()
 {
     $this->objectManager->getFilters()->disable('softdeleteable');
     $source = new Entity('CSBillClientBundle:Client');
     /** @var ClientRepository $repo */
     $repo = $this->objectManager->getRepository('CSBillClientBundle:Client');
     $queryBuilder = $repo->createQueryBuilder('c');
     $queryBuilder->where('c.deletedAt is not null');
     $source->initQueryBuilder($queryBuilder);
     return $source;
 }
开发者ID:Codixis,项目名称:CSBill,代码行数:14,代码来源:ClientDeletedGrid.php

示例9: setParameter

 /**
  * Sets a parameter that can be used by the filter.
  *
  * @param string      $name  Name of the parameter.
  * @param string      $value Value of the parameter.
  * @param string|null $type  The parameter type. If specified, the given value will be run through
  *                           the type conversion of this type. This is usually not needed for
  *                           strings and numeric types.
  *
  * @return SQLFilter The current SQL filter.
  */
 public final function setParameter($name, $value, $type = null)
 {
     if (null === $type) {
         $type = ParameterTypeInferer::inferType($value);
     }
     $this->parameters[$name] = array('value' => $value, 'type' => $type);
     // Keep the parameters sorted for the hash
     ksort($this->parameters);
     // The filter collection of the EM is now dirty
     $this->em->getFilters()->setFiltersStateDirty();
     return $this;
 }
开发者ID:Dren-x,项目名称:mobitnew,代码行数:23,代码来源:SQLFilter.php

示例10: setDraftVersionFilter

 /**
  * Kills the DraftVersionFilter
  */
 public function setDraftVersionFilter($enabled = true)
 {
     if ($this->em->getFilters()->isEnabled('draft') && !$enabled) {
         $this->em->getFilters()->disable('draft');
     } else {
         if (!$this->em->getFilters()->isEnabled('draft') && $enabled) {
             $this->em->getFilters()->enable('draft');
         }
     }
 }
开发者ID:Opifer,项目名称:Cms,代码行数:13,代码来源:BlockManager.php

示例11: bootExtension

 /**
  * @param Extension $extension
  */
 public function bootExtension(Extension $extension)
 {
     $hash = spl_object_hash($this->em);
     if (isset($this->subscribedExtensions[$hash][get_class($extension)])) {
         //This extension is already subscribed to this entity manager.
         return;
     }
     $extension->addSubscribers($this->evm, $this->em, $this->reader);
     if (is_array($extension->getFilters())) {
         foreach ($extension->getFilters() as $name => $filter) {
             $this->metadata->addFilter($name, $filter);
             $this->em->getFilters()->enable($name);
         }
     }
     $this->subscribedExtensions[$hash][get_class($extension)] = true;
 }
开发者ID:jee7,项目名称:orm,代码行数:19,代码来源:ExtensionManager.php

示例12: 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.
  */
 protected function generateFilterConditionSQL(ClassMetadata $targetEntity, $targetTableAlias)
 {
     $filterClauses = array();
     foreach ($this->em->getFilters()->getEnabledFilters() as $filter) {
         if ('' !== ($filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias))) {
             $filterClauses[] = '(' . $filterExpr . ')';
         }
     }
     $sql = implode(' AND ', $filterClauses);
     return $sql ? "(" . $sql . ")" : "";
     // Wrap again to avoid "X or Y and FilterConditionSQL"
 }
开发者ID:BusinessCookies,项目名称:CoffeeMachineProject,代码行数:20,代码来源:BasicEntityPersister.php

示例13: registerFilters

 /**
  * @param array                  $settings
  * @param Configuration          $configuration
  * @param EntityManagerInterface $manager
  */
 protected function registerFilters(array $settings = [], Configuration $configuration, EntityManagerInterface $manager)
 {
     if (isset($settings['filters'])) {
         foreach ($settings['filters'] as $name => $filter) {
             $configuration->addFilter($name, $filter);
             $manager->getFilters()->enable($name);
         }
     }
 }
开发者ID:shuaijinchao,项目名称:laravel-doctrine,代码行数:14,代码来源:EntityManagerFactory.php

示例14: getFilters

 /**
  * {@inheritdoc}
  */
 public function getFilters()
 {
     return $this->wrapped->getFilters();
 }
开发者ID:Dren-x,项目名称:mobitnew,代码行数:7,代码来源:EntityManagerDecorator.php

示例15: enableFilter

 /**
  * @param string $filterName
  */
 public function enableFilter($filterName)
 {
     $this->entityManager->getFilters()->enable($filterName);
 }
开发者ID:FaustineMastrodicasa,项目名称:sfs,代码行数:7,代码来源:AbstractManager.php


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