Symfony Repositories: Limit the “R” in CRUD while in development
Limit your CRUD indexAction so it won’t show 5,000+ records and crash with memory error:
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
// LIMIT LIST to 10 (whatever you put in the 3rd field below:
$entities = $em ->getRepository(‘MainFormBundle:SomeEntity’)->findBy(
array(), // $where
array(), // $orderBy
10, // $limit
0 // $offset
);
return $this->render(‘MainFormBundle:SomeEntity:index.html.twig’, array(
‘entities’ => $entities,
));
}