I have the following two code. Which code is good in terms of performance?
$gd = $this->getDoctrine();
$em = $gd->getEntityManager();
$data = $gd->getRepository('MyB:MyC')->find...;
// update $data.
$em->persist($data);
$em->flush();
I want to know its memory usage and execution speed.
$data = $this->getDoctrine()->getRepository('MyB:MyC')->find...;
// update $data.
$this->getDoctrine()->getEntityManager()->persist($data);
$this->getDoctrine()->getEntityManager()->flush();