1 | <?php |
||
25 | abstract class MetaAnnotation extends Annotation implements MetaAnnotationInterface |
||
26 | { |
||
27 | |||
28 | /** |
||
29 | * Name of annotated field/method/class |
||
30 | * @var string |
||
31 | */ |
||
32 | public $name = ''; |
||
33 | |||
34 | /** |
||
35 | * Model metadata object |
||
36 | * |
||
37 | * NOTE: Deprecation notice is only to discourage direct use in annotations, this is actually required |
||
38 | * @deprecated Use getMeta() instead |
||
39 | * |
||
40 | * @var Meta |
||
41 | */ |
||
42 | private $_meta = null; |
||
43 | |||
44 | /** |
||
45 | * Annotations entity, it can be either class, property, or method |
||
46 | * Its concrete annotation implementation responsibility to decide what to do with it. |
||
47 | * |
||
48 | * NOTE: Deprecation notice is only to discourage direct use in annotations, this is actually required |
||
49 | * @deprecated Use getEntity() instead |
||
50 | * |
||
51 | * @var AnnotationEntityInterface |
||
52 | */ |
||
53 | private $_entity = null; |
||
54 | |||
55 | 22 | public function setName($name) |
|
59 | |||
60 | /** |
||
61 | * Set metadata class to be accessible for annotation for init etc. methods |
||
62 | * @param Meta $meta |
||
63 | */ |
||
64 | 22 | public function setMeta(Meta $meta) |
|
68 | |||
69 | /** |
||
70 | * Get metadata class for whole entity. |
||
71 | * |
||
72 | * This allows access to type, method or property in any annotation, |
||
73 | * regardles of it's location. |
||
74 | * |
||
75 | * @return Meta |
||
76 | */ |
||
77 | public function getMeta() |
||
78 | { |
||
79 | return $this->_meta; |
||
80 | } |
||
81 | |||
82 | /** |
||
83 | * Set annotatins entity, it can be either class, property, or method |
||
84 | * @param AnnotationEntityInterface $entity |
||
85 | */ |
||
86 | 22 | public function setEntity(AnnotationEntityInterface $entity) |
|
90 | |||
91 | /** |
||
92 | * Get annotated entity. |
||
93 | * |
||
94 | * Use this in annotations definitions to define it's params, ie: |
||
95 | * |
||
96 | * ```php |
||
97 | * public function init() |
||
98 | * { |
||
99 | * $this->getEntity()->someValue = $this->value; |
||
100 | * } |
||
101 | * ``` |
||
102 | * |
||
103 | * @return AnnotatedEntityInteface |
||
104 | */ |
||
105 | 22 | public function getEntity() |
|
109 | |||
110 | /** |
||
111 | * This function should be called after all annotations are initialized. |
||
112 | * Any code that depends on other annotations can be executed here. |
||
113 | * NOTE: This is not ensured to run, its annotations container responsibility to call it. |
||
114 | * @deprecated since version number 5 |
||
115 | */ |
||
116 | public function afterInit() |
||
120 | |||
121 | } |
||
122 |