Below you will find pages that utilize the taxonomy term “DocComment”
Articles
read more
Symfony2: Creating a Metadata Factory for Processing Custom Annotations
Earlier I wrote about how to create a custom annotation class. I used the annotation reader from Doctrine Common to check for the existence of the custom annotation inside the DocComment block. It is also possible to process the annotations on beforehand, and collect the processed data in ClassMetadata
and PropertyMetadata
objects. These objects are created by a MetadataFactory
. The factory uses Drivers
to collect the metadata.
My purpose in this article is to create a custom annotation @DefaultValue
which allows me to define default values for properties of a class. It should work like this: