ocbxug
Last Updated: February 25, 2016
·
524
· 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();
Say Thanks
Respond