Commit f731a083 authored by romanb's avatar romanb

[2.0][DDC-41] Fixed. Also related to DDC-2.

parent c71b4ebd
<?php
namespace Doctrine\ORM\Proxy;
/**
* Marker interface for proxy classes.
*
* @author Roman Borschel <roman@code-factory.org>
* @since 2.0
*/
interface Proxy {}
\ No newline at end of file
......@@ -214,7 +214,7 @@ class ProxyClassGenerator
'<?php
/** This class was generated by the Doctrine ORM. DO NOT EDIT THIS FILE. */
namespace Doctrine\Generated\Proxies {
class <proxyClassName> extends \<className> {
class <proxyClassName> extends \<className> implements \Doctrine\ORM\Proxy\Proxy {
private $_entityPersister;
private $_identifier;
private $_loaded = false;
......@@ -247,7 +247,7 @@ namespace Doctrine\Generated\Proxies {
'<?php
/** This class was generated by the Doctrine ORM. DO NOT EDIT THIS FILE. */
namespace Doctrine\Generated\Proxies {
class <proxyClassName> extends \<className> {
class <proxyClassName> extends \<className> implements \Doctrine\ORM\Proxy\Proxy {
private $_em;
private $_assoc;
private $_owner;
......
......@@ -26,7 +26,8 @@ use Doctrine\Common\Collections\ArrayCollection,
Doctrine\Common\DoctrineException,
Doctrine\Common\NotifyPropertyChanged,
Doctrine\Common\PropertyChangedListener,
Doctrine\ORM\Event\LifecycleEventArgs;
Doctrine\ORM\Event\LifecycleEventArgs,
Doctrine\ORM\Proxy\Proxy;
/**
* The UnitOfWork is responsible for tracking changes to objects during an
......@@ -554,10 +555,13 @@ class UnitOfWork implements PropertyChangedListener
if ( ! $assoc->isCascadePersist) {
return; // "Persistence by reachability" only if persist cascade specified
}
// Look through the entities, and in any of their associations, for transient
// enities, recursively. ("Persistence by reachability")
if ($assoc->isOneToOne()) {
if ($value instanceof Proxy) {
return; // Ignore proxy objects
}
$value = array($value);
}
$targetClass = $this->_em->getClassMetadata($assoc->targetEntityName);
......@@ -586,7 +590,9 @@ class UnitOfWork implements PropertyChangedListener
$data[$name] = $refProp->getValue($entry);
$changeSet[$name] = array(null, $data[$name]);
if (isset($targetClass->associationMappings[$name])) {
$this->_computeAssociationChanges($targetClass->associationMappings[$name], $data[$name]);
if ($data[$name] !== null) {
$this->_computeAssociationChanges($targetClass->associationMappings[$name], $data[$name]);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment