diff --git a/src/Models/Scene.php b/src/Models/Scene.php index c4e0732..182c47a 100644 --- a/src/Models/Scene.php +++ b/src/Models/Scene.php @@ -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; /** @@ -23,6 +23,7 @@ class Scene implements CreateableInterface, SceneConnectable { use Creator; + use Deletor; use SceneBasics; /** @Id @Column(type="integer") @GeneratedValue */ @@ -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(); - } }