當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。