本文整理汇总了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;
}
示例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;
}
示例3: createQuery
public function createQuery($context = 'list')
{
/** @var FcRequestQuery $query */
$query = parent::createQuery($context);
$query->filterByFcForm($this->getFcForm());
return $query;
}
示例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;
}
示例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;
}
示例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;
}
示例7: createQuery
/**
* {@inheritdoc}
*/
public function createQuery($context = 'list')
{
/** @var PublicationQuery $query */
$query = parent::createQuery($context);
$query->filterByPublicationType($this->getPublicationType());
return $query;
}
示例8: createQuery
public function createQuery($context = 'list')
{
$query = parent::createQuery($context);
$query->leftJoin('o.translations', 't');
$query->addSelect('t');
return $query;
}
示例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;
}
示例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;
}
示例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()));
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}