Reputation: 683
I want to retrieve all my fields that have the annotation @Translatable in an entity, for example :
class WonderfulClass
{
/**
* @var string
* @Gedmo\Translatable
*/
private $aField;
/**
* @var string
* @Gedmo\Translatable
*/
private $otherField;
/**
* @var string
*/
private $lastField;
In this case, I want to retrieve fields that have the @Gedmo\Translatable annotation ($aField and $otherField).
Does somebody knows how to do this ?
Upvotes: 5
Views: 3304
Reputation: 20185
You can use the Doctrine Annotations Reader : https://github.com/doctrine/annotations
Or read the DocComments with the native PHP Reflection Class : http://php.net/manual/en/reflectionclass.getdoccomment.php
Upvotes: 3