Skip to content

Commit

Permalink
Revert "Fixs a weird bug causing the deletion of scens to NOT cascade…
Browse files Browse the repository at this point in the history
…, despite passing tests."

This reverts commit 848e6b0.
  • Loading branch information
Vassyli committed Mar 13, 2017
1 parent 848e6b0 commit 03fc114
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions src/Models/Scene.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Table;

use LotGD\Core\Exceptions\ArgumentException;
use LotGD\Core\Tools\Model\Creator;
use LotGD\Core\Tools\Model\Deletor;
use LotGD\Core\Tools\Model\SceneBasics;

/**
Expand All @@ -23,6 +23,7 @@
class Scene implements CreateableInterface, SceneConnectable
{
use Creator;
use Deletor;
use SceneBasics;

/** @Id @Column(type="integer") @GeneratedValue */
Expand Down Expand Up @@ -288,27 +289,4 @@ public function connect(

return $connection;
}

/**
* Deletes this entity and all connected children.
*
* This is a fix to a weird bug causing the deletion to NOT cascade, despite the tests passing.
* @param EntityManager $em
*/
public function delete(EntityManager $em)
{
// Delete connections
$connections = $this->getConnections();
foreach ($connections as $connection) {
$em->remove($connection);
}

// Delete connection groups
foreach ($this->connectionGroups as $group) {
$em->remove($group);
}

$em->remove($this);
$em->flush();
}
}

0 comments on commit 03fc114

Please sign in to comment.