简体   繁体   English

在Symfony的Doctrine实体中@var注释是什么?

[英]What is the @var annotation for in a Doctrine entity in Symfony?

Perhaps a silly question but it bugs me that I don't know ... 也许是一个愚蠢的问题,但它让我感到困惑,我不知道......

When I create an entity with app/console doctrine:generate:entity it adds an @var annotation to each property. 当我使用app/console doctrine:generate:entity创建一个实体时,它会为每个属性添加一个@var注释。 What is @var used for? @var用于什么?

It obviously indicates the data type but I don't see it mentioned in any documentation and things seems to work whether it's there or not so I just wonder what uses it. 它显然表明了数据类型,但我没有在任何文档中看到它,并且无论是否存在,事情似乎都有效,所以我只是想知道是什么用它。

This is a standard phpdoc comment. 这是一个标准的phpdoc评论。 It has nothing to do with Doctrine annotations, and they are ignored by Doctrine. 它与Doctrine注释无关,而且它们被Doctrine忽略了。 They are used when generating documentation and also as metadata for IDE's that support code completion. 它们在生成文档时使用,也可作为支持代码完成的IDE的元数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM