DRY: how to use this code in several entities accross Symfony2 project? Traits?
I have this repetitive piece of code that will be used in more than one entity in my Symfony2 project so will be fine to apply some kind of DRY, if it's possible of course, and I'm thinking in PHP Traits . private static $preDeletedEntities;// static array that will contain entities due to deletion. private static $deletedEntities;// static array that will contain entities that were deleted (well, at least the SQL was thrown). /** * This callback will be called on the preRemove event * @ORM\PreRemove */ public function entityDueToDeletion() { // This entity is due to be deleted though not