An issue I’ve come across a couple of times recently, by making a small mistake, is persisting a form input to Doctrine using Symfony2.
The issue I was having, was that when calling the persist method of the Entity Manager, I was passing it the form instead of the entity. I came across it due to the controller I was working on being quite odd, but it’s very easy to just type the wrong name as lots of people use very similar names for their form and the entity it relates to, for obvious reasons.
The key here is to just recognise this error quickly, as it’s not very simple to spot in your code, and the message you receive doesn’t make it very obvious at first glance. The key is just remembering ‘Symfony\Component\Form\Form’ as it is unlikely you’ll see this for any other reason, since it’s caused by trying to persist a part of the framework into the database.