Removing Entities in Doctrine2

Posted by Mitch Viner on 12 January 2012 | 0 Comments

Tags: ,

Removing entities in doctrine2 is concpetually and easy process. I'm referring to removing the actual model class and the physical php file. I just had to remove a few of them from my application. I thought, easy, I'll delete the file, drop the table, remove any references in my other entities and clear the cache and I should be good to go So needless to say, I was surprised to get an error saying that the ClassMetadataFacrtory.php file could not find one of my entities on line 223.

Well, I beat my head against the wall on this for hours, I walked through the code using the stack trace and in my debugging I found a couple references to my existing classes in other entities. Long story short, I forgot I had extended the User entity to own one of the entities I was removing. This was causing everything! I updated the User entity to remove the reference to the now deleted Entity.

Moral of the story: Make sure you have double checked all entities to ensure the one(s) you are removing are not referenced anywhere within the model layer.


Post your comment

Comments

No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments