Symfony & Doctrine: Using try… catch to determine success or failure of database insert or update action

In Doctrine, there is no simple way to access the Doctrine object and get the status of the last attempt at inserting or updating the database. To overcome this glaring limitation of the DBAL (Database Abstraction Layer), we have to resort to older PHP techniques like using a try… catch condition.

Seems like a lot of code to do something we old-school PHP devs have been able to do with the mysql object for a decade now, but this is the reality of it.

Aaron Belchamber has written 247 articles

Leave a Reply

Your email address will not be published. Required fields are marked *