Why does Sonata Bundle give me an error when trying to load a list of more than 1000 records?

0

I am using the Sonata bundle in symfony 4.1 to manage my entities, the problem is that when I try to enter the administration of an entity that has about 1300 records it sends me this error

  

Error: Maximum execution time of 30 seconds exceeded

This is my class that I use to configure the administration of my entity Ubicacion

class UbicacionAdmin extends _Admin_
{
    /**
     * {@inheritDoc}
     */
    public static function getEntity()
    {
        return Ubicacion::class;
    }

    /**
     * @param FormMapper $formMapper
     */
    protected function configureFormFields(FormMapper $formMapper)
    {
        $em = $this->modelManager->getEntityManager(Nomenclador::class);

        $query = $em->createQueryBuilder('n')
            ->select('n')
            ->from('App:Nomenclador', 'n')
            ->leftJoin('n.entidad', 'e')
            ->where('e.id = :entidad')
            ->setParameter('entidad', EntidadFixture::UBICACION);
        $formMapper->with('label.principal', ['class' => 'col-md-7'])
            ->add('nombre', Type\TextType::class, [
                'label' => 'label.nombre'
            ])
            ->add('nomenclador', EntityType::class, [
                'class' => Nomenclador::class,
                'multiple' => false,
                'by_reference' => true,
                'required' => true,
                'query_builder' => $query,
                'label' => 'label.tipo'
            ])->end()->with('label.detalle',['class' => 'col-md-5'])
                ->add('padre', EntityType::class, [
                'class' => Ubicacion::class,
                'multiple' => false,
                'by_reference' => true,
                'required' => true,
                'label' => 'label.padre'
            ])->end();

    }

    /**
     * {@inheritDoc}
     * @throws \RuntimeException
     */
    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('nombre', self::LIST_TYPE_STRING, [
                'label' => 'label.nombre'
            ])
            ->add('nomenclador', self::LIST_TYPE_STRING, [
                'label' => 'label.nomenclador'
            ])
            ->add('padre', self::LIST_TYPE_STRING, [
                'label' => 'label.padre'
            ]);

        return parent::configureListFields($listMapper);
    }
}
    
asked by Dariel Ramos Díaz de Villegas 04.12.2018 в 15:49
source

0 answers