本文整理汇总了PHP中Sonata\AdminBundle\Datagrid\ProxyQueryInterface::getQueryBuilder方法的典型用法代码示例。如果您正苦于以下问题:PHP ProxyQueryInterface::getQueryBuilder方法的具体用法?PHP ProxyQueryInterface::getQueryBuilder怎么用?PHP ProxyQueryInterface::getQueryBuilder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sonata\AdminBundle\Datagrid\ProxyQueryInterface
的用法示例。
在下文中一共展示了ProxyQueryInterface::getQueryBuilder方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addIdentifiersToQuery
/**
* {@inheritdoc}
*/
public function addIdentifiersToQuery($class, ProxyQueryInterface $queryProxy, array $idx)
{
$fieldNames = $this->getIdentifierFieldNames($class);
$qb = $queryProxy->getQueryBuilder();
$prefix = uniqid();
$sqls = array();
foreach ($idx as $pos => $id) {
$ids = explode(self::ID_SEPARATOR, $id);
$ands = array();
foreach ($fieldNames as $posName => $name) {
$parameterName = sprintf('field_%s_%s_%d', $prefix, $name, $pos);
$ands[] = sprintf('%s.%s = :%s', $qb->getRootAlias(), $name, $parameterName);
$qb->setParameter($parameterName, $ids[$posName]);
}
$sqls[] = implode(' AND ', $ands);
}
$qb->andWhere(sprintf('( %s )', implode(' OR ', $sqls)));
}
示例2: addIdentifiersToQuery
/**
* {@inheritdoc}
*/
public function addIdentifiersToQuery($class, ProxyQueryInterface $queryProxy, array $idx)
{
$queryBuilder = $queryProxy->getQueryBuilder();
$queryBuilder->field('_id')->in($idx);
}
示例3: addIdentifiersToQuery
/**
* {@inheritDoc}
*/
public function addIdentifiersToQuery($class, ProxyQueryInterface $queryProxy, array $idx)
{
/** @var $queryProxy ProxyQuery */
$qb = $queryProxy->getQueryBuilder();
$orX = $qb->andWhere()->orX();
foreach ($idx as $id) {
$path = $this->getBackendId($id);
$orX->same($path, $queryProxy->getAlias());
}
}
示例4: callbackMethod
public function callbackMethod(ProxyQueryInterface $proxyQuery, $alias, $field, $data)
{
$queryBuilder = $proxyQuery->getQueryBuilder();
$queryBuilder->andWhere()->eq()->field('a.' . $field)->literal($data['value']);
return true;
}