#1172 - fixed minor CS issues (spacing)
This commit is contained in:
parent
45e733eb60
commit
57ce6ccfcf
@ -3319,10 +3319,10 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
/**
|
/**
|
||||||
* @param object $entity
|
* @param object $entity
|
||||||
* @param object $managedCopy
|
* @param object $managedCopy
|
||||||
|
*
|
||||||
* @throws ORMException
|
* @throws ORMException
|
||||||
* @throws OptimisticLockException
|
* @throws OptimisticLockException
|
||||||
* @throws TransactionRequiredException
|
* @throws TransactionRequiredException
|
||||||
* @internal param ClassMetadata $class
|
|
||||||
*/
|
*/
|
||||||
private function mergeEntityStateIntoManagedCopy($entity, $managedCopy)
|
private function mergeEntityStateIntoManagedCopy($entity, $managedCopy)
|
||||||
{
|
{
|
||||||
@ -3330,13 +3330,16 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
|
|
||||||
foreach ($class->reflClass->getProperties() as $prop) {
|
foreach ($class->reflClass->getProperties() as $prop) {
|
||||||
$name = $prop->name;
|
$name = $prop->name;
|
||||||
|
|
||||||
$prop->setAccessible(true);
|
$prop->setAccessible(true);
|
||||||
if (!isset($class->associationMappings[$name])) {
|
|
||||||
if (!$class->isIdentifier($name)) {
|
if ( ! isset($class->associationMappings[$name])) {
|
||||||
|
if ( ! $class->isIdentifier($name)) {
|
||||||
$prop->setValue($managedCopy, $prop->getValue($entity));
|
$prop->setValue($managedCopy, $prop->getValue($entity));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$assoc2 = $class->associationMappings[$name];
|
$assoc2 = $class->associationMappings[$name];
|
||||||
|
|
||||||
if ($assoc2['type'] & ClassMetadata::TO_ONE) {
|
if ($assoc2['type'] & ClassMetadata::TO_ONE) {
|
||||||
$other = $prop->getValue($entity);
|
$other = $prop->getValue($entity);
|
||||||
if ($other === null) {
|
if ($other === null) {
|
||||||
@ -3346,10 +3349,11 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
// do not merge fields marked lazy that have not been fetched.
|
// do not merge fields marked lazy that have not been fetched.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!$assoc2['isCascadeMerge']) {
|
|
||||||
|
if ( ! $assoc2['isCascadeMerge']) {
|
||||||
if ($this->getEntityState($other) === self::STATE_DETACHED) {
|
if ($this->getEntityState($other) === self::STATE_DETACHED) {
|
||||||
$targetClass = $this->em->getClassMetadata($assoc2['targetEntity']);
|
$targetClass = $this->em->getClassMetadata($assoc2['targetEntity']);
|
||||||
$relatedId = $targetClass->getIdentifierValues($other);
|
$relatedId = $targetClass->getIdentifierValues($other);
|
||||||
|
|
||||||
if ($targetClass->subClasses) {
|
if ($targetClass->subClasses) {
|
||||||
$other = $this->em->find($targetClass->name, $relatedId);
|
$other = $this->em->find($targetClass->name, $relatedId);
|
||||||
@ -3367,14 +3371,16 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$mergeCol = $prop->getValue($entity);
|
$mergeCol = $prop->getValue($entity);
|
||||||
if ($mergeCol instanceof PersistentCollection && !$mergeCol->isInitialized()) {
|
|
||||||
|
if ($mergeCol instanceof PersistentCollection && ! $mergeCol->isInitialized()) {
|
||||||
// do not merge fields marked lazy that have not been fetched.
|
// do not merge fields marked lazy that have not been fetched.
|
||||||
// keep the lazy persistent collection of the managed copy.
|
// keep the lazy persistent collection of the managed copy.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$managedCol = $prop->getValue($managedCopy);
|
$managedCol = $prop->getValue($managedCopy);
|
||||||
if (!$managedCol) {
|
|
||||||
|
if ( ! $managedCol) {
|
||||||
$managedCol = new PersistentCollection(
|
$managedCol = new PersistentCollection(
|
||||||
$this->em,
|
$this->em,
|
||||||
$this->em->getClassMetadata($assoc2['targetEntity']),
|
$this->em->getClassMetadata($assoc2['targetEntity']),
|
||||||
@ -3382,19 +3388,21 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
);
|
);
|
||||||
$managedCol->setOwner($managedCopy, $assoc2);
|
$managedCol->setOwner($managedCopy, $assoc2);
|
||||||
$prop->setValue($managedCopy, $managedCol);
|
$prop->setValue($managedCopy, $managedCol);
|
||||||
$oid = spl_object_hash($entity);
|
|
||||||
$this->originalEntityData[$oid][$name] = $managedCol;
|
$this->originalEntityData[spl_object_hash($entity)][$name] = $managedCol;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($assoc2['isCascadeMerge']) {
|
if ($assoc2['isCascadeMerge']) {
|
||||||
$managedCol->initialize();
|
$managedCol->initialize();
|
||||||
|
|
||||||
// clear and set dirty a managed collection if its not also the same collection to merge from.
|
// clear and set dirty a managed collection if its not also the same collection to merge from.
|
||||||
if (!$managedCol->isEmpty() && $managedCol !== $mergeCol) {
|
if ( ! $managedCol->isEmpty() && $managedCol !== $mergeCol) {
|
||||||
$managedCol->unwrap()->clear();
|
$managedCol->unwrap()->clear();
|
||||||
$managedCol->setDirty(true);
|
$managedCol->setDirty(true);
|
||||||
|
|
||||||
if ($assoc2['isOwningSide'] && $assoc2['type'] == ClassMetadata::MANY_TO_MANY && $class->isChangeTrackingNotify(
|
if ($assoc2['isOwningSide']
|
||||||
)
|
&& $assoc2['type'] == ClassMetadata::MANY_TO_MANY
|
||||||
|
&& $class->isChangeTrackingNotify()
|
||||||
) {
|
) {
|
||||||
$this->scheduleForDirtyCheck($managedCopy);
|
$this->scheduleForDirtyCheck($managedCopy);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user