Sonata admin form mapper one-to-many relation with too many entries <p>I have a performance problem with sonata.</p> <p>I built a form with a one-to-many relation that works great between operation on several products, everything is fine in dev environment, but in production, I have 250000 products to be managed that makes queries very slow… I have an ajax query to replace my selector's content according to the maker of the product, but the first call (which param all the CRUD logic) is far too long…</p> <p>Here is my form mapper </p> <pre><code>-&gt;add( 'operationhasproducts', 'sonata_type_model', array( 'class' =&gt; 'MyBundle\Entity\Operationhasproducts', 'query' =&gt; $this-&gt;modelManager-&gt;createQuery('MyBundle\Entity\Product'), 'multiple' =&gt; true, 'by_reference' =&gt; false, 'btn_add' =&gt; false, 'required' =&gt; false ) ) </code></pre> <p>How can I keep the logic without loading 250000 products on loading the page </p> <p>I tried to put <code>'query'=&gt; $this-&gt;modelManager-&gt;createQuery('MyBundle\Entity\Product')-&gt;setMaxResults(10),</code> the form displays but then the crud logic no longer works, I have a data transformation error</p> <pre><code>Symfony\Component\Validator\ConstraintViolation Object(Symfony\Component\Form\Form).children[operationhasproducts] = [0 =&gt; 2739, 1 =&gt; 29217] Caused by: Symfony\Component\Form\Exception\TransformationFailedException Unable to reverse value for property path "operationhasproducts": Could not find all matching choices for the given values Caused by: Symfony\Component\Form\Exception\TransformationFailedException Could not find all matching choices for the given values </code></pre> <p>Any help will be welcome</p>