removes restrictions on constructors of embedded objects
This commit is contained in:
parent
ece62d6ad7
commit
5586ddd6b7
@ -57,7 +57,7 @@ class ReflectionEmbeddedProperty
|
||||
$embeddedObject = $this->parentProperty->getValue($object);
|
||||
|
||||
if ($embeddedObject === null) {
|
||||
$embeddedObject = new $this->class; // TODO
|
||||
$embeddedObject = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->class), $this->class));
|
||||
$this->parentProperty->setValue($object, $embeddedObject);
|
||||
}
|
||||
|
||||
|
@ -176,10 +176,28 @@ class DDC93Person
|
||||
/** @Embedded(class="DDC93Address") */
|
||||
public $address;
|
||||
|
||||
/** @Embedded(class = "DDC93Timestamps") */
|
||||
public $timestamps;
|
||||
|
||||
public function __construct($name = null, DDC93Address $address = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->address = $address;
|
||||
$this->timestamps = new DDC93Timestamps(new \DateTime);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Embeddable
|
||||
*/
|
||||
class DDC93Timestamps
|
||||
{
|
||||
/** @Column(type = "datetime") */
|
||||
public $createdAt;
|
||||
|
||||
public function __construct(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user