77use Doctrine \ORM \Mapping \Column ;
88use Doctrine \ORM \Mapping \Entity ;
99use Doctrine \ORM \Mapping \Id ;
10+ use Doctrine \ORM \Mapping \OneToMany ;
1011use Doctrine \ORM \Mapping \Table ;
1112use LotGD \Core \Exceptions \ArgumentException ;
1213use LotGD \Core \Exceptions \ClassNotFoundException ;
1314use LotGD \Core \SceneTemplates \SceneTemplateInterface ;
15+ use LotGD \Core \Tools \Model \UserAssignable ;
1416
1517/**
1618 * Class SceneTemplates.
1921 */
2022class SceneTemplate
2123{
24+ use UserAssignable;
25+
2226 /** @Id @Column(type="string", length=255, unique=True, name="class") */
2327 protected string $ class ;
2428
2529 /** @Column(type="string", length=255, name="module") */
2630 protected string $ module ;
2731
28- /** @Column(type="boolean", options={"default"=true}) */
29- protected bool $ userAssignable = true ;
30-
3132 /**
3233 * @OneToMany(targetEntity="Scene", mappedBy="template")
3334 * @var Collection<Scene>
@@ -44,10 +45,11 @@ class SceneTemplate
4445 * SceneTemplates constructor.
4546 * @param string $class FQCN of the scene handling class.
4647 * @param string $module Module from where the class is from.
47- * @throws ClassNotFoundException
48+ * @param bool $userAssignable Set to false to flag the scene as not-assignable for the user.
4849 * @throws ArgumentException
50+ * @throws ClassNotFoundException
4951 */
50- public function __construct (string $ class , string $ module )
52+ public function __construct (string $ class , string $ module, bool $ userAssignable = true )
5153 {
5254 if (!\class_exists ($ class )) {
5355 throw new ClassNotFoundException ("The class {$ class } cannot be found. " );
@@ -57,6 +59,7 @@ public function __construct(string $class, string $module)
5759
5860 $ this ->class = $ class ;
5961 $ this ->module = $ module ;
62+ $ this ->setUserAssignable ($ userAssignable );
6063 }
6164
6265 /**
0 commit comments