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 ...@@ -214,7 +214,7 @@ class ProxyClassGenerator
'<?php '<?php
/** This class was generated by the Doctrine ORM. DO NOT EDIT THIS FILE. */ /** This class was generated by the Doctrine ORM. DO NOT EDIT THIS FILE. */
namespace Doctrine\Generated\Proxies { namespace Doctrine\Generated\Proxies {
class <proxyClassName> extends \<className> { class <proxyClassName> extends \<className> implements \Doctrine\ORM\Proxy\Proxy {
private $_entityPersister; private $_entityPersister;
private $_identifier; private $_identifier;
private $_loaded = false; private $_loaded = false;
...@@ -247,7 +247,7 @@ namespace Doctrine\Generated\Proxies { ...@@ -247,7 +247,7 @@ namespace Doctrine\Generated\Proxies {
'<?php '<?php
/** This class was generated by the Doctrine ORM. DO NOT EDIT THIS FILE. */ /** This class was generated by the Doctrine ORM. DO NOT EDIT THIS FILE. */
namespace Doctrine\Generated\Proxies { namespace Doctrine\Generated\Proxies {
class <proxyClassName> extends \<className> { class <proxyClassName> extends \<className> implements \Doctrine\ORM\Proxy\Proxy {
private $_em; private $_em;
private $_assoc; private $_assoc;
private $_owner; private $_owner;
......
...@@ -26,7 +26,8 @@ use Doctrine\Common\Collections\ArrayCollection, ...@@ -26,7 +26,8 @@ use Doctrine\Common\Collections\ArrayCollection,
Doctrine\Common\DoctrineException, Doctrine\Common\DoctrineException,
Doctrine\Common\NotifyPropertyChanged, Doctrine\Common\NotifyPropertyChanged,
Doctrine\Common\PropertyChangedListener, 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 * The UnitOfWork is responsible for tracking changes to objects during an
...@@ -554,10 +555,13 @@ class UnitOfWork implements PropertyChangedListener ...@@ -554,10 +555,13 @@ class UnitOfWork implements PropertyChangedListener
if ( ! $assoc->isCascadePersist) { if ( ! $assoc->isCascadePersist) {
return; // "Persistence by reachability" only if persist cascade specified return; // "Persistence by reachability" only if persist cascade specified
} }
// Look through the entities, and in any of their associations, for transient // Look through the entities, and in any of their associations, for transient
// enities, recursively. ("Persistence by reachability") // enities, recursively. ("Persistence by reachability")
if ($assoc->isOneToOne()) { if ($assoc->isOneToOne()) {
if ($value instanceof Proxy) {
return; // Ignore proxy objects
}
$value = array($value); $value = array($value);
} }
$targetClass = $this->_em->getClassMetadata($assoc->targetEntityName); $targetClass = $this->_em->getClassMetadata($assoc->targetEntityName);
...@@ -586,7 +590,9 @@ class UnitOfWork implements PropertyChangedListener ...@@ -586,7 +590,9 @@ class UnitOfWork implements PropertyChangedListener
$data[$name] = $refProp->getValue($entry); $data[$name] = $refProp->getValue($entry);
$changeSet[$name] = array(null, $data[$name]); $changeSet[$name] = array(null, $data[$name]);
if (isset($targetClass->associationMappings[$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