Last Updated: February 25, 2016
·
621
· limonazzo

Insert Doctrine - PHP

Get the "entity manager":

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

Set values:

$user = new user();
$user->setName('Isaac');
$user->setAge(25);

Save:

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