I've got Movie
entity, which has ManyToMany
connections with such entities as Actor
, Director
, Producer,
Company` etc.
There are lots of those entities (Actor: 90k, Director: 40k, Producer: 20k, Company: 40k) to choose from, when editing the Movie.
When I try to load the "edit" page for my entity in Sonata Admin, I get error 500 and php logs say Allowed memory size of 134217728 bytes exhausted
in one of the following files:
\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php on line 2577
\vendor\doctrine\orm\lib\Doctrine\ORM\Internal\Hydration\AbstractHydrator.php on line 296
\vendor\doctrine\orm\lib\Doctrine\ORM\Internal\Hydration\ObjectHydrator.php on line 529
It worked on fixtures, when there were like 10 objects in DB for every entity.
I'm currently testing migration and I assumed there will be a huge load of data on the edit page and the page itself may work slow (there will be four select2 fields, each multiple choice, each will have thousands of entities to connect to the edited entity), but I am surprised it happens on the Doctrine level. I was hoping Sonata Admin will handle it, as it has no problem with listing huge amount of Actor
objects, pagination etc.
How should I arrange working with Movie
entity? Can you advise me something? I'm thinking of changing that CRUD page so Select2 would fetch data with Ajax, but I'm still not sure it's a best idea.