I would like to have custom annotations on my entity that will do something on persist event, but defined thru annotations. An example:
/**
* @ORM\Entity
* @Searchable("column"="title")
*/
class Product
{
}
That @Searchable annotation should somehow trigger my code that will read column title, separate words and save into its own table (much simplified example of what I really need).
I am aware I can use doctrine listeners and register them in config.yml but I really need this to be done thru entity annotations so that searchable bundle could be easily reused thru different projects. I read tons of docs, even tried to understand Gedmo behaviours bundle code but I failed. Can somehow show me how to do this, in an idiot-proof way?
I even read http://php-and-symfony.matthiasnoback.nl/2011/12/symfony2-doctrine-common-creating-powerful-annotations/ but that was kinda too complicated.