Skip to content

Commit cc3a24a

Browse files
committed
* Stricter MetaAnnotation interface
1 parent 1369c24 commit cc3a24a

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

Maslosoft/Addendum/Collections/Meta.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected function __construct(IAnnotated $component = null, MetaOptions $option
101101
{
102102
continue;
103103
}
104-
$annotation->name = $info->name;
104+
$annotation->setName($info->name);
105105
$annotation->setEntity($this->_type);
106106
$annotation->setMeta($this);
107107
$annotation->setComponent($component);
@@ -125,13 +125,11 @@ protected function __construct(IAnnotated $component = null, MetaOptions $option
125125
continue;
126126
}
127127

128-
$annotation->name = $method->name;
128+
$annotation->setName($method->name);
129129
$annotation->setEntity($methodMeta);
130130
$annotation->setMeta($this);
131131
$annotation->setComponent($component);
132132
$annotation->init();
133-
// if($method->name == 'actionSitemap')
134-
// var_dump(get_class($annotation));
135133
$annotations[] = $annotation;
136134
$hasAnnotations = true;
137135
}
@@ -183,7 +181,7 @@ protected function __construct(IAnnotated $component = null, MetaOptions $option
183181
continue;
184182
}
185183

186-
$annotation->name = $field->name;
184+
$annotation->setName($field->name);
187185
$annotation->setEntity($field);
188186
$annotation->setMeta($this);
189187
$annotation->setComponent($component);

Maslosoft/Addendum/Collections/MetaAnnotation.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ abstract class MetaAnnotation extends Annotation implements IMetaAnnotation
3232
*/
3333
protected $_entity = null;
3434

35+
public function setName($name)
36+
{
37+
$this->name = $name;
38+
}
39+
3540
/**
3641
* Set metada class to be accessible for annotation for init etc. methods
3742
* @param Meta $meta

Maslosoft/Addendum/Interfaces/IMetaAnnotation.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
*/
1111
interface IMetaAnnotation
1212
{
13+
/**
14+
* Set entity name (class name, method name or property name)
15+
*/
16+
public function setName($name);
1317

1418
/**
1519
* Set metada class to be accessible for annotation for init etc. methods

0 commit comments

Comments
 (0)