I looked through a few posts but did not find a working solution.
My question is simple:
I have an entity with the words id , url and title . The URL must be unique (in MySQL PDO). I managed to create both an entity and a schema without problems. Now that I am going through a few entries, I call persist() for each, and finaly a flush() . The problem is that when I try to insert duplicate entries for the url, this gives me an exception. How to suppress it?
When a duplicate entry is inserted, it should just skip it and insert the rest. There is no need for events, UPDATE operations, triggers, and all these bizarre things.
I tried to catch any exceptions thrown by persist or flush() , but it may not seem like this is correct.
Any ideas are welcome, thanks!
EDIT: found my solution here: Symfony2 controller will not catch exception
source share