Symfony 2.1 Don';在Symfony 2.1中首次加载sonata管理包时不显示列表
我正在使用Symfony 2.1 Don';在Symfony 2.1中首次加载sonata管理包时不显示列表,symfony-2.1,sonata-admin,Symfony 2.1,Sonata Admin,我正在使用Symfony 2.1和Sonata Admin bundle来实现管理功能。现在我有很多数据要在列表视图中显示,这在默认情况下是我不喜欢的。我想第一次只显示过滤器,然后根据过滤字段只显示相关数据。你知道怎么做吗 在管理类中,您可以覆盖createQuery: /** * Set a standard filter for the list view * @param string $context [description] * @retur
Symfony 2.1
和Sonata Admin bundle
来实现管理功能。现在我有很多数据要在列表视图中显示,这在默认情况下是我不喜欢的。我想第一次只显示过滤器,然后根据过滤字段只显示相关数据。你知道怎么做吗 在管理类中,您可以覆盖createQuery:
/**
* Set a standard filter for the list view
* @param string $context [description]
* @return [type] [description]
*/
public function createQuery($context = 'list')
{
$query = $this->getModelManager()->createQuery('Company\MyBundle\Entity\Client', 'c');
$query->where("c.state = 'todo'");
return $query;
}
默认情况下不显示任何内容是不可能的,但还是只添加一个查询,这样它就永远不会返回结果?比如“状态=测试我的应用程序”