1818use PhpList \Core \Domain \Model \Traits \CreationDateTrait ;
1919use PhpList \Core \Domain \Model \Traits \IdentityTrait ;
2020use PhpList \Core \Domain \Model \Traits \ModificationDateTrait ;
21+ use Symfony \Component \Serializer \Attribute \Groups ;
22+ use Symfony \Component \Serializer \Attribute \MaxDepth ;
2123
2224/**
2325 * This class represents an administrator who can log to the system, is allowed to administer
@@ -35,14 +37,17 @@ class SubscriberList implements DomainModel, Identity, CreationDate, Modificatio
3537
3638 #[ORM \Column]
3739 #[SerializedName("name " )]
40+ #[Groups(['SubscriberList ' ])]
3841 private string $ name = '' ;
3942
4043 #[ORM \Column]
4144 #[SerializedName("description " )]
45+ #[Groups(['SubscriberList ' ])]
4246 private string $ description = '' ;
4347
4448 #[ORM \Column(name: "entered " , type: "datetime " , nullable: true )]
4549 #[SerializedName("creation_date " )]
50+ #[Groups(['SubscriberList ' ])]
4651 protected ?DateTime $ creationDate = null ;
4752
4853 #[ORM \Column(name: "modified " , type: "datetime " )]
@@ -51,11 +56,13 @@ class SubscriberList implements DomainModel, Identity, CreationDate, Modificatio
5156
5257 #[ORM \Column(name: "listorder " , type: "integer " )]
5358 #[SerializedName("list_position " )]
54- private int $ listPosition = 0 ;
59+ #[Groups(['SubscriberList ' ])]
60+ private ?int $ listPosition ;
5561
5662 #[ORM \Column(name: "prefix " )]
5763 #[SerializedName("subject_prefix " )]
58- private string $ subjectPrefix = '' ;
64+ #[Groups(['SubscriberList ' ])]
65+ private ?string $ subjectPrefix ;
5966
6067 #[ORM \Column(name: "active " , type: "boolean " )]
6168 #[SerializedName("public " )]
@@ -75,6 +82,7 @@ class SubscriberList implements DomainModel, Identity, CreationDate, Modificatio
7582 targetEntity: "PhpList\Core\Domain\Model\Subscription\Subscription " ,
7683 cascade: ["remove " ]
7784 )]
85+ #[MaxDepth(1 )]
7886 private Collection $ subscriptions ;
7987
8088 #[ORM \ManyToMany(
@@ -87,6 +95,7 @@ class SubscriberList implements DomainModel, Identity, CreationDate, Modificatio
8795 joinColumns: [new ORM \JoinColumn (name: "listid " )],
8896 inverseJoinColumns: [new ORM \JoinColumn (name: "userid " )]
8997 )]
98+ #[MaxDepth(1 )]
9099 private Collection $ subscribers ;
91100
92101 public function __construct ()
@@ -117,7 +126,7 @@ public function setDescription(string $description): void
117126
118127 public function getListPosition (): int
119128 {
120- return $ this ->listPosition ;
129+ return $ this ->listPosition ?? 0 ;
121130 }
122131
123132 public function setListPosition (int $ listPosition ): void
@@ -127,7 +136,7 @@ public function setListPosition(int $listPosition): void
127136
128137 public function getSubjectPrefix (): string
129138 {
130- return $ this ->subjectPrefix ;
139+ return $ this ->subjectPrefix ?? '' ;
131140 }
132141
133142 public function setSubjectPrefix (string $ subjectPrefix ): void
@@ -137,7 +146,7 @@ public function setSubjectPrefix(string $subjectPrefix): void
137146
138147 public function isPublic (): bool
139148 {
140- return $ this ->public ;
149+ return $ this ->public ?? false ;
141150 }
142151
143152 public function setPublic (bool $ public ): void
@@ -147,7 +156,7 @@ public function setPublic(bool $public): void
147156
148157 public function getCategory (): string
149158 {
150- return $ this ->category ;
159+ return $ this ->category ?? '' ;
151160 }
152161
153162 public function setCategory (string $ category ): void
0 commit comments