Skip to content

Commit 06d7f40

Browse files
authored
Merge pull request #1 from WenowFr/feature/reattach-entity-before-updating-status
Reattach entity
2 parents c8a54b9 + 6d7448f commit 06d7f40

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Command/ExecuteCommand.php

+4
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ private function executeCommand(ScheduledCommand $scheduledCommand, OutputInterf
249249
$this->em = $this->em->create($this->em->getConnection(), $this->em->getConfiguration());
250250
}
251251

252+
// Force re-attach entity with entity manager before updating it, in case $scheduledCommand has been detached
253+
// https://www.doctrine-project.org/projects/doctrine-orm/en/2.8/reference/working-with-objects.html#detaching-entities
254+
$scheduledCommand = $this->em->find(ScheduledCommand::class, $scheduledCommand);
255+
252256
$scheduledCommand->setLastReturnCode($result);
253257
$scheduledCommand->setLocked(false);
254258
$scheduledCommand->setExecuteImmediately(false);

0 commit comments

Comments
 (0)