Symfony2: get the id of the persisted object Symfony2: get the id of the persisted object symfony symfony

Symfony2: get the id of the persisted object


Symfony2 with Doctrine as default ORM will automatically generate an ID after data stored in database. So you can call the ID by ->getId()

$id = $person->getId();