Last Updated: February 25, 2016
·
1.451K
· limonazzo

Delete Doctrine - PHP

Get EM

$em = $this->getDoctrine()->getEntityManager();

find entity by ID

$user = $em->getRepository('Entity\User')->find($id);

Delete:

$em->remove($user);
$em->flush();