简体   繁体   中英

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.

I have an article entity, and those articles can be linked to multiple biographies (~ 100 000 biographies in database).

Here is a part of my ArticleAdmin.php class.

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.

With the latest version of Sonata Admin Bundle, the select comes with an autocompletion field.

My question is: is there any way to load only 50 or 100 biographies and to load more by filtering with the autocompletion field?

Thanks for your help!

您需要使用sonata_type_model_list ,请参阅相关文档: http : sonata_type_model_list

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM