Revert "Fixs a weird bug causing the deletion of scens to NOT cascade, despite passing tests."

This reverts commit 848e6b022c.
This commit is contained in:
Vassyli
2017-03-13 14:13:50 +01:00
parent 848e6b022c
commit 03fc114775
+2 -24
View File
@@ -5,12 +5,12 @@ namespace LotGD\Core\Models;
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;
/**
@@ -23,6 +23,7 @@ use LotGD\Core\Tools\Model\SceneBasics;
class Scene implements CreateableInterface, SceneConnectable
{
use Creator;
use Deletor;
use SceneBasics;
/** @Id @Column(type="integer") @GeneratedValue */
@@ -288,27 +289,4 @@ class Scene implements CreateableInterface, SceneConnectable
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();
}
}