本文整理匯總了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;
}