[英]Performance issues with Sonata Admin entity listing
I am using Symfony2 and Sonata Admin Bundle but I am encountering performance issues with entity listing in edit mode. 我正在使用Symfony2和Sonata Admin Bundle,但是在编辑模式下实体列表出现性能问题。
I have an article entity, and those articles can be linked to multiple biographies (~ 100 000 biographies in database). 我有一个文章实体,这些文章可以链接到多个传记(数据库中约有10万个传记)。
Here is a part of my ArticleAdmin.php class. 这是我的ArticleAdmin.php类的一部分。
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('biographies', 'entity', array(
'class' => 'SJBiographyBundle:Biography',
'multiple' => true
))
->end();
}
This generates a select with my 100 000 biographies when I am editing my article (and it works fine), except that loading 100 000 objects from the database takes a lot of time. 当我编辑我的文章时(这可以正常工作),这对我的100 000个传记产生了一个选择,除了从数据库中加载100 000个对象需要花费大量时间。
With the latest version of Sonata Admin Bundle, the select comes with an autocompletion field. 在最新版本的Sonata Admin Bundle中,选择项带有自动完成字段。
My question is: is there any way to load only 50 or 100 biographies and to load more by filtering with the autocompletion field? 我的问题是:是否可以通过自动完成字段过滤来加载50或100个传记,并加载更多传记?
Thanks for your help! 谢谢你的帮助!
您需要使用sonata_type_model_list
,请参阅相关文档: http : sonata_type_model_list
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.