#1169 DDC-3343 - one-to-many persister should only interact with the data when orphanRemoval
and EXTRA_LAZY
are combined
This commit is contained in:
parent
4884183b95
commit
4bed15b984
@ -223,6 +223,13 @@ class OneToManyPersister extends AbstractCollectionPersister
|
|||||||
*/
|
*/
|
||||||
public function removeElement(PersistentCollection $coll, $element)
|
public function removeElement(PersistentCollection $coll, $element)
|
||||||
{
|
{
|
||||||
|
$mapping = $coll->getMapping();
|
||||||
|
|
||||||
|
if ( ! $mapping['orphanRemoval']) {
|
||||||
|
// no-op: this is not the owning side, therefore no operations should be applied
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$uow = $this->em->getUnitOfWork();
|
$uow = $this->em->getUnitOfWork();
|
||||||
|
|
||||||
// shortcut for new entities
|
// shortcut for new entities
|
||||||
@ -238,9 +245,9 @@ class OneToManyPersister extends AbstractCollectionPersister
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mapping = $coll->getMapping();
|
$class = $this->em->getClassMetadata($mapping['targetEntity']);
|
||||||
$persister = $this->uow->getEntityPersister($mapping['targetEntity']);
|
$sql = 'DELETE FROM ' . $this->quoteStrategy->getTableName($class, $this->platform)
|
||||||
$targetMetadata = $this->em->getClassMetadata($mapping['targetEntity']);
|
. ' WHERE ' . implode('= ? AND ', $class->getIdentifierColumnNames()) . ' = ?';
|
||||||
|
|
||||||
if ($element instanceof Proxy && ! $element->__isInitialized()) {
|
if ($element instanceof Proxy && ! $element->__isInitialized()) {
|
||||||
$element->__load();
|
$element->__load();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user