Conceptually it's bad practice because entities are just meant to *store*data. The only methods they should have are simple set and get methods. Nothing more. If you start adding other logic to them, then you're changing the purpose of entities and it can start to make your code more difficult to maintain and modify.
It's considered better practice to put the kind of code you have in your snippet in Doctrine 2 repository classes or directly in one of your services (or a combination of the two), depending on what it is you're trying to do. You can specific Doctrine repository classes in your ORM pretty easily. If you're using YAML and your entity class is called Wicked, you can specify a repository as follows: repositoryClass: SomeVendor\MyAwesomeBundle\Model\WickedRepository ...where SomeVendor\MyAwesomeBundle\Model\WickedRepository is the location of your repository class. -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en