问题
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. What is @var
used for?
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.
回答1:
This is a standard phpdoc comment. It has nothing to do with Doctrine annotations, and they are ignored by Doctrine. They are used when generating documentation and also as metadata for IDE's that support code completion.
来源:https://stackoverflow.com/questions/15274560/what-is-the-var-annotation-for-in-a-doctrine-entity-in-symfony