本文整理汇总了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);
}