本文整理匯總了PHP中Sonata\AdminBundle\Admin\AdminInterface::createQuery方法的典型用法代碼示例。如果您正苦於以下問題:PHP AdminInterface::createQuery方法的具體用法?PHP AdminInterface::createQuery怎麽用?PHP AdminInterface::createQuery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sonata\AdminBundle\Admin\AdminInterface
的用法示例。
在下文中一共展示了AdminInterface::createQuery方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getBaseDatagrid
/**
* @param \Sonata\AdminBundle\Admin\AdminInterface $admin
* @param array $values
* @return \Sonata\AdminBundle\Datagrid\DatagridInterface
*/
public function getBaseDatagrid(AdminInterface $admin, array $values = array())
{
$pager = new Pager();
$pager->setCountColumn($admin->getModelManager()->getIdentifierFieldNames($admin->getClass()));
$formBuilder = $this->formFactory->createNamedBuilder('form', 'filter', array(), array('csrf_protection' => false));
return new Datagrid($admin->createQuery(), $admin->getList(), $pager, $formBuilder, $values);
}
示例2: getBaseDatagrid
/**
* {@inheritdoc}
*/
public function getBaseDatagrid(AdminInterface $admin, array $values = array())
{
$pager = new Pager();
$defaultOptions = array();
$defaultOptions['csrf_protection'] = false;
$formBuilder = $this->formFactory->createNamedBuilder('filter', 'form', array(), $defaultOptions);
$proxyQuery = $admin->createQuery();
// if the default modelmanager query builder is used, we need to replace it with elastica
// if not, that means $admin->createQuery has been overriden by the user and already returns an ElasticaProxyQuery object
if (!$proxyQuery instanceof ElasticaProxyQuery) {
if ($this->isSmart($admin, $values)) {
$proxyQuery = new ElasticaProxyQuery($this->finderProvider->getFinderByAdmin($admin));
}
}
return new Datagrid($proxyQuery, $admin->getList(), $pager, $formBuilder, $values);
}
示例3: getBaseDatagrid
/**
* {@inheritdoc}
*/
public function getBaseDatagrid(AdminInterface $admin, array $values = array())
{
$pager = $this->getPager($admin->getPagerType());
$pager->setCountColumn($admin->getModelManager()->getIdentifierFieldNames($admin->getClass()));
$defaultOptions = array();
if ($this->csrfTokenEnabled) {
$defaultOptions['csrf_protection'] = false;
}
$formBuilder = $this->formFactory->createNamedBuilder('filter', 'form', array(), $defaultOptions);
return new Datagrid($admin->createQuery(), $admin->getList(), $pager, $formBuilder, $values);
}
示例4: getBaseDatagrid
/**
* {@inheritdoc}
*/
public function getBaseDatagrid(AdminInterface $admin, array $values = array())
{
$defaultOptions = array();
if ($this->csrfTokenEnabled) {
$defaultOptions['csrf_protection'] = false;
}
$formBuilder = $this->formFactory->createNamedBuilder('filter', 'form', array(), $defaultOptions);
return new Datagrid($admin->createQuery(), $admin->getList(), $this->getPager(), $formBuilder, $values);
}