Max*_*ard 5 php annotations symfony doctrine-orm
我想检索实体中具有注释 @Translatable 的所有字段,例如:
class WonderfulClass
{
/**
* @var string
* @Gedmo\Translatable
*/
private $aField;
/**
* @var string
* @Gedmo\Translatable
*/
private $otherField;
/**
* @var string
*/
private $lastField;
Run Code Online (Sandbox Code Playgroud)
在本例中,我想检索具有 @Gedmo\Translatable 注释的字段($aField 和 $otherField)。
有人知道该怎么做吗?
您可以使用 Doctrine Annotations Reader:https://github.com/doctrine/annotations
或者使用本机 PHP 反射类阅读 DocComments:http://php.net/manual/en/reflectionclass.getdoccomment.php