1
0
mirror of synced 2025-01-08 10:07:10 +03:00

removes restrictions on constructors of embedded objects

This commit is contained in:
Johannes M. Schmitt 2013-11-02 13:27:17 +01:00
parent ece62d6ad7
commit 5586ddd6b7
2 changed files with 19 additions and 1 deletions

View File

@ -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);
}

View File

@ -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;
}
}