當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ProxyQueryInterface::getQueryBuilder方法代碼示例

本文整理匯總了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)));
 }
開發者ID:LamaDelRay,項目名稱:test_symf,代碼行數:21,代碼來源:ModelManager.php

示例2: addIdentifiersToQuery

 /**
  * {@inheritdoc}
  */
 public function addIdentifiersToQuery($class, ProxyQueryInterface $queryProxy, array $idx)
 {
     $queryBuilder = $queryProxy->getQueryBuilder();
     $queryBuilder->field('_id')->in($idx);
 }
開發者ID:jdshao,項目名稱:symfony_backstage,代碼行數:8,代碼來源:ModelManager.php

示例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());
     }
 }
開發者ID:Aaike,項目名稱:SonataDoctrinePhpcrAdminBundle,代碼行數:13,代碼來源:ModelManager.php

示例4: callbackMethod

 public function callbackMethod(ProxyQueryInterface $proxyQuery, $alias, $field, $data)
 {
     $queryBuilder = $proxyQuery->getQueryBuilder();
     $queryBuilder->andWhere()->eq()->field('a.' . $field)->literal($data['value']);
     return true;
 }
開發者ID:Aaike,項目名稱:SonataDoctrinePhpcrAdminBundle,代碼行數:6,代碼來源:CallBackFilterTest.php


注:本文中的Sonata\AdminBundle\Datagrid\ProxyQueryInterface::getQueryBuilder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。