Skip to content

Commit

Permalink
something is odd with sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
goetas committed Nov 15, 2024
1 parent 75fa53c commit 56ce570
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions src/UnitOfWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -2390,29 +2390,27 @@ private function doDetach(

$visited[$oid] = $entity; // mark visited

switch ($this->getEntityState($entity, self::STATE_DETACHED)) {
case self::STATE_MANAGED:
if ($this->isInIdentityMap($entity)) {
$this->removeFromIdentityMap($entity);
}
$state = $this->getEntityState($entity, self::STATE_DETACHED);
if (! $noCascade && $state === self::STATE_MANAGED) {
$this->cascadeDetach($entity, $visited);
}

unset(
$this->entityInsertions[$oid],
$this->entityUpdates[$oid],
$this->entityDeletions[$oid],
$this->entityIdentifiers[$oid],
$this->entityStates[$oid],
$this->originalEntityData[$oid]
);
break;
case self::STATE_NEW:
case self::STATE_DETACHED:
return;
if ($state !== self::STATE_MANAGED) {
return;
}

if (! $noCascade) {
$this->cascadeDetach($entity, $visited);
if ($this->isInIdentityMap($entity)) {
$this->removeFromIdentityMap($entity);
}

unset(
$this->entityInsertions[$oid],
$this->entityUpdates[$oid],
$this->entityDeletions[$oid],
$this->entityIdentifiers[$oid],
$this->entityStates[$oid],
$this->originalEntityData[$oid]
);
}

/**
Expand Down

0 comments on commit 56ce570

Please sign in to comment.