1
0
mirror of synced 2025-02-20 22:23:14 +03:00

ReflectionEmbeddedProperty should be like any ReflectionProperty, and should therefore extend it for type compatibility

This commit is contained in:
Marco Pivetta 2014-12-05 13:06:41 +01:00
parent 112fdf46d0
commit b4a23e97a9

View File

@ -31,7 +31,7 @@ use ReflectionProperty;
*
* TODO: Move this class into Common\Reflection
*/
class ReflectionEmbeddedProperty
class ReflectionEmbeddedProperty extends ReflectionProperty
{
/**
* @var ReflectionProperty
@ -43,11 +43,6 @@ class ReflectionEmbeddedProperty
*/
private $childProperty;
/**
* @var string
*/
private $class;
/**
* @var Instantiator|null
*/
@ -62,15 +57,14 @@ class ReflectionEmbeddedProperty
{
$this->parentProperty = $parentProperty;
$this->childProperty = $childProperty;
$this->class = (string) $class;
parent::__construct($childProperty->getDeclaringClass()->getName(), $childProperty->getName());
}
/**
* @param $object
*
* @return object|null
* {@inheritDoc}
*/
public function getValue($object)
public function getValue($object = null)
{
$embeddedObject = $this->parentProperty->getValue($object);
@ -82,10 +76,9 @@ class ReflectionEmbeddedProperty
}
/**
* @param object $object
* @param mixed $value
* {@inheritDoc}
*/
public function setValue($object, $value)
public function setValue($object, $value = null)
{
$embeddedObject = $this->parentProperty->getValue($object);