I have a large Symfony 2 form in a huge collection (over 10,000 objects). For simple reasons, I cannot display one of thousands of objects. I show the shape of about 300 objects.
I did not find a way to filter the collection into a form and thus do the following:
$bigSetOfObjects = array( 'myObject' => $this ->getDoctrine() ->getRepository('MyObject') ->findBy(... ) ); $form = $this->createForm(new MyObjectForm(), $bigSetOfObjects);
Everything works great. The form displays with the correct values, and the update also works great. Data is correctly stored in the database. The problem is that Doctrine performs one update for each object , which means that the entire page contains about 300 SQL statements causing problems .
I do not understand that I am updating only a couple of form values, and not all of them. So why can't Doctrine detect updated objects and thus only update those objects in the database?
Is there something I'm doing wrong? Did I forget?
source share