Details
-
Type:
Improvement
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.0.0-BETA2
-
Component/s: None
-
Labels:None
Description
1) If our annotation doesn't need any parameters, it stll can accept one ('value').
2) We can intercept set and get of annotation properties via __set and __get methods which is not final, but not for 'value'.
Example of interception
class Annotation extends \Doctrine\Common\Annotations\Annotation
{
private $someProperty;
public function __set($name, $value)
{
$setMethod = 'set' . ucfirst($name);
if (method_exists($this, $setMethod)) {
return $this->{$setMethod}($value);
}
return parent::__set($name, $value);
}
public function __get($name)
{
$getMethod = 'get' . ucfirst($name);
if (method_exists($this, $getMethod)) {
return $this->{$getMethod}();
}
return parent::__get($name);
}
public function getSomeProperty()
{
//some logic
return $this->someProperty;
}
protected function setSomeProperty($someProperty)
{
//some logic
$this->someProperty = $someProperty;
}
}
Why is this even relevant? can't you just ignore the value property?