The process of Hydration is one of the most time and memory consuming in the ORM.
When you’re retrieving many rows from the database only to show them in the view (e.g. in a some sort of listing/CRUD), hydrating them to the object may not make sense.
Instead you should use simpler hydration modes like arrays/scalar:
<?php
$qb = new \Doctrine\ORM\QueryBuilder;
$arrayResults = $qb->getQuery()->getArrayResult();
$scalarResults = $qb->getQuery()->getScalarResult();
Comments
Post a Comment