Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.x
-
Fix Version/s: None
-
Component/s: ORM
-
Security Level: All
-
Labels:None
Description
It would be nice to have the entity manager return $this in methods like persist and remove, so instead of having this:
$em = $this->get('doctrine')->getEntityManager();
$user = $em->find('AcmeHelloBundle:User', $id);
$em->remove($user);
$em->flush();
One could do this:
$em = $this->get('doctrine')->getEntityManager();
$user = $em->find('AcmeHelloBundle:User', $id);
$em
->remove($user)
->flush();
It is a small improvement (and perhaps its not the best case to demonstrate it) but it makes using the entity manager more comfortable.
A fluent interface shouldnt be introduced just for convenience, it makes no sense here semenatically.