[2.0][DDC-41] Fixed. Also related to DDC-2.
This commit is contained in:
parent
c71b4ebd71
commit
f731a083b6
3 changed files with 22 additions and 5 deletions
11
lib/Doctrine/ORM/Proxy/Proxy.php
Normal file
11
lib/Doctrine/ORM/Proxy/Proxy.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Doctrine\ORM\Proxy;
|
||||
|
||||
/**
|
||||
* Marker interface for proxy classes.
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @since 2.0
|
||||
*/
|
||||
interface Proxy {}
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue