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


PHP Admin::createQuery方法代码示例

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


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

示例1: createQuery

 public function createQuery($context = 'list')
 {
     $query = parent::createQuery($context);
     if ($context === 'list') {
         $alias = current($query->getDQLPart('from'))->getAlias();
         $query->andWhere($alias . '.parent IS NULL');
     }
     return $query;
 }
开发者ID:adespresso,项目名称:FeatureBundle,代码行数:9,代码来源:FeatureAdmin.php

示例2: createQuery

 public function createQuery($context = 'list')
 {
     /** @var ProxyQuery|QueryBuilder $query */
     $query = parent::createQuery($context);
     if ($context == 'list') {
         $parameters = $this->getFilterParameters();
         $domainValue = isset($parameters['domain']) ? $parameters['domain'] : false;
         list($tableAlias) = $query->getQueryBuilder()->getRootAliases();
         if ($domainValue) {
             $query->where($tableAlias . '.domain = :domain')->setParameter('domain', $domainValue);
         }
         $emptyLocale = !empty($parameters['emptyLocale']['value']) ? $parameters['emptyLocale']['value'] : false;
         if ($emptyLocale) {
             $query->andWhere($tableAlias . '.translations NOT LIKE :emptyLocale')->setParameter('emptyLocale', '%s:2:"' . $emptyLocale . '"%');
         }
         $location = !empty($parameters['location']['value']) ? $parameters['location']['value'] : false;
         if ($location) {
             if ($location == self::FILTER_LOCATION_FRONTEND) {
                 $query->andWhere($tableAlias . '.source NOT LIKE :excludeAdmin')->setParameter('excludeAdmin', '%admin\\.%');
             } elseif ($location == self::FILTER_LOCATION_BACKEND) {
                 $query->andWhere($tableAlias . '.source LIKE :excludeAdmin')->setParameter('excludeAdmin', '%admin\\.%');
             }
         }
     }
     return $query;
 }
开发者ID:octava,项目名称:cms,代码行数:26,代码来源:TranslationAdmin.php

示例3: createQuery

 public function createQuery($context = 'list')
 {
     /** @var FcRequestQuery $query */
     $query = parent::createQuery($context);
     $query->filterByFcForm($this->getFcForm());
     return $query;
 }
开发者ID:it-blaster,项目名称:form-constructor-bundle,代码行数:7,代码来源:FcRequestAdmin.php

示例4: createQuery

 public function createQuery($context = 'list')
 {
     $query = parent::createQuery($context);
     $query->andWhere($query->expr()->eq($query->getRootAliases()[0] . '.customer', ':my_param'));
     $query->setParameter('my_param', true);
     return $query;
 }
开发者ID:Nexotap,项目名称:Ivory,代码行数:7,代码来源:CustomerAdmin.php

示例5: createQuery

 public function createQuery($context = 'list')
 {
     $query = parent::createQuery($context);
     $query->andWhere($query->expr()->eq($query->getRootAliases()[0] . '.deleteFlag', ':not_delete'));
     $query->setParameter('not_delete', 0);
     return $query;
 }
开发者ID:kurmin,项目名称:ts_project,代码行数:7,代码来源:BaseAdmin.php

示例6: createQuery

 public function createQuery($context = 'list')
 {
     $query = parent::createQuery($context);
     $query->andWhere($query->expr()->eq($query->getRootAliases()[0] . '.type', ':type'));
     $query->setParameter(':type', Department::BRANCH);
     return $query;
 }
开发者ID:19eugen86,项目名称:schedro.symfony,代码行数:7,代码来源:BranchAdmin.php

示例7: createQuery

 /**
  * {@inheritdoc}
  */
 public function createQuery($context = 'list')
 {
     /** @var PublicationQuery $query */
     $query = parent::createQuery($context);
     $query->filterByPublicationType($this->getPublicationType());
     return $query;
 }
开发者ID:it-blaster,项目名称:publications-bundle,代码行数:10,代码来源:PublicationAdmin.php

示例8: createQuery

 public function createQuery($context = 'list')
 {
     $query = parent::createQuery($context);
     $query->leftJoin('o.translations', 't');
     $query->addSelect('t');
     return $query;
 }
开发者ID:kminh,项目名称:AOTranslationBundle,代码行数:7,代码来源:MessageAdmin.php

示例9: createQuery

 /**
  * {@inheritDoc}
  */
 public function createQuery($context = 'list')
 {
     /** @var QueryBuilder $query */
     $query = parent::createQuery($context);
     $alias = $query->getRootAliases()[0];
     $query->orderBy($alias . '.isPublished', 'ASC')->addOrderBy($alias . '.publishedAt', 'DESC');
     return $query;
 }
开发者ID:harentius,项目名称:blog-bundle,代码行数:11,代码来源:AbstractPostAdmin.php

示例10: createQuery

 /**
  * @param   string $context
  *
  * @return \Sonata\AdminBundle\Datagrid\ProxyQueryInterface
  */
 public function createQuery($context = 'list')
 {
     $query = parent::createQuery($context);
     $query->andWhere($query->expr()->eq($query->getRootAlias() . '.site', ':my_param'));
     $query->addOrderBy($query->getRootAlias() . '.root', 'ASC');
     $query->addOrderBy($query->getRootAlias() . '.lft', 'ASC');
     $query->setParameter('my_param', $this->getCurrentSite());
     return $query;
 }
开发者ID:skillberto,项目名称:SonataPageMenuBundle,代码行数:14,代码来源:MenuAdmin.php

示例11: createQuery

 /**
  * Cambiar la forma en que muestra el listado de acciones de sala,
  * si es un usuario normal solo le muestra las acciones que ha ingresado
  * @return \Sonata\AdminBundle\Datagrid\ProxyQueryInterface
  */
 public function createQuery($context = 'list')
 {
     $query = parent::createQuery($context);
     $usuario = $this->getConfigurationPool()->getContainer()->get('security.context')->getToken()->getUser();
     if ($usuario->hasRole('ROLE_SUPER_ADMIN')) {
         return new ProxyQuery($query->where('1=1'));
     } else {
         return new ProxyQuery($query->where($query->getRootAlias() . '.usuario = ' . $usuario->getId()));
     }
 }
开发者ID:SM2015,项目名称:Etab-hibrido,代码行数:15,代码来源:SalaAccionesAdmin.php

示例12: createQuery

 /**
  * @param string $context
  * @return \Sonata\AdminBundle\Datagrid\ProxyQueryInterface
  */
 public function createQuery($context = 'list')
 {
     /** @var $query \Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQuery */
     $query = parent::createQuery($context);
     /** @var $builder \Doctrine\ORM\QueryBuilder */
     $builder = $query->getQueryBuilder();
     $builder->andWhere($builder->getRootAlias() . '.client=:client')->setParameter(':client', $this->getClient());
     //var_dump($query->__toString(), $this->getClient()->getId());
     return $query;
 }
开发者ID:defan-marunchak,项目名称:eurotax,代码行数:14,代码来源:AbstractTabsAdmin.php

示例13: createQuery

 /**
  * @param string $context
  * @return QueryBuilder
  */
 public function createQuery($context = 'list')
 {
     /** @var QueryBuilder $queryBuilder */
     $queryBuilder = parent::createQuery($context);
     $whiteList = $this->getWhiteList();
     if (!$this->getUser()->getShowHidden() && !empty($whiteList)) {
         $queryBuilder->andWhere($queryBuilder->expr()->in('o.username', $whiteList));
     }
     return $queryBuilder;
 }
开发者ID:octava,项目名称:cms,代码行数:14,代码来源:AdministratorAdmin.php

示例14: createQuery

 public function createQuery($context = 'list')
 {
     $qb = parent::createQuery($context);
     $this->fecha = new \DateTime("now");
     $current_context = $this->getCurrentContext();
     if ('vencidos' == $current_context) {
         # Creo subquery para saber todos los horaios vencidos
         $alias = $qb->getRootAlias();
         $qb->andWhere($alias . '.fechaHasta < :fecha')->setParameter('fecha', $this->fecha);
     }
     return $qb;
 }
开发者ID:jonny100,项目名称:bedeliafceyt,代码行数:12,代码来源:HorarioAdmin.php

示例15: createQuery

 public function createQuery($context = 'list')
 {
     $query = $this->getModelManager()->createQuery('AppBundle\\Entity\\Department');
     $query->andWhere($query->expr()->eq($query->getRootAliases()[0] . '.type', ':type'));
     $query->setParameter(':type', $this->getDepartmentType());
     $departments = $query->execute();
     $query = parent::createQuery($context);
     $query->andWhere($query->expr()->eq($query->getRootAliases()[0] . '.department', ':department'));
     $query->setParameter(':department', $departments[0]);
     for ($i = 1; $i < count($departments); $i++) {
         $query->orWhere($query->expr()->eq($query->getRootAliases()[0] . '.department', ':department' . $i));
         $query->setParameter(':department' . $i, $departments[$i]);
     }
     return $query;
 }
开发者ID:19eugen86,项目名称:schedro.symfony,代码行数:15,代码来源:WarehouseAdmin.php


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