diff --git a/src/Models/Scene.php b/src/Models/Scene.php index 8d3f8ac..1202029 100644 --- a/src/Models/Scene.php +++ b/src/Models/Scene.php @@ -30,13 +30,13 @@ class Scene implements CreateableInterface private $id; /** - * @ManyToOne(targetEntity="Scene") + * @ManyToOne(targetEntity="Scene", cascade={"persist"}) * @JoinColumn(name="parent", referencedColumnName="id", nullable=true) */ private $parent = null; /** - * @OneToMany(targetEntity="Scene", mappedBy="parent") + * @OneToMany(targetEntity="Scene", mappedBy="parent", cascade={"persist", "remove"}) */ private $children = []; diff --git a/src/Module.php b/src/Module.php index 7ccbfb0..df27aaf 100644 --- a/src/Module.php +++ b/src/Module.php @@ -9,6 +9,18 @@ use LotGD\Core\Models\Module as ModuleModel; */ interface Module extends EventHandler { + /** + * Called when an event is published that is handled by this class. + * + * @param Game $g The game. + * @param string $event Name of this event. + * @param array $context Arbitrary dictionary representing context around this event. + * @return array|null Return an array if you want to make changes to the $context before + * the next handler is called. Otherwise, return null. Any changes made will be propogated + * to the event publisher as well. + */ + public static function handleEvent(Game $g, string $event, array &$context); + /** * Lifecycle method called when this module is initially installed. Use * this method to perform one-time setup operations like adding tables