|
5 | 5 | namespace PhpList\Core\Domain\Identity\Model; |
6 | 6 |
|
7 | 7 | use DateTime; |
| 8 | +use Doctrine\Common\Collections\ArrayCollection; |
| 9 | +use Doctrine\Common\Collections\Collection; |
8 | 10 | use Doctrine\ORM\Mapping as ORM; |
9 | 11 | use InvalidArgumentException; |
10 | 12 | use PhpList\Core\Domain\Common\Model\Interfaces\CreationDate; |
|
13 | 15 | use PhpList\Core\Domain\Common\Model\Interfaces\ModificationDate; |
14 | 16 | use PhpList\Core\Domain\Common\Model\Interfaces\OwnableInterface; |
15 | 17 | use PhpList\Core\Domain\Identity\Repository\AdministratorRepository; |
| 18 | +use PhpList\Core\Domain\Subscription\Model\SubscriberList; |
16 | 19 |
|
17 | 20 | /** |
18 | 21 | * This class represents an administrator who can log to the system, is allowed to administer |
@@ -65,11 +68,15 @@ class Administrator implements DomainModel, Identity, CreationDate, Modification |
65 | 68 | #[ORM\Column(name: 'privileges', type: 'text', nullable: true)] |
66 | 69 | private ?string $privileges = null; |
67 | 70 |
|
| 71 | + #[ORM\OneToMany(targetEntity: SubscriberList::class, mappedBy: 'owner')] |
| 72 | + private Collection $ownedLists; |
| 73 | + |
68 | 74 | public function __construct() |
69 | 75 | { |
70 | 76 | $this->createdAt = new DateTime(); |
71 | 77 | $this->updatedAt = new DateTime(); |
72 | 78 | $this->email = ''; |
| 79 | + $this->ownedLists = new ArrayCollection(); |
73 | 80 | } |
74 | 81 |
|
75 | 82 | public function getId(): ?int |
@@ -211,4 +218,12 @@ public function setUpdatedAt(): void |
211 | 218 | { |
212 | 219 | $this->updatedAt = new DateTime(); |
213 | 220 | } |
| 221 | + |
| 222 | + /** |
| 223 | + * @return Collection<int, SubscriberList> |
| 224 | + */ |
| 225 | + public function getOwnedLists(): Collection |
| 226 | + { |
| 227 | + return $this->ownedLists; |
| 228 | + } |
214 | 229 | } |
0 commit comments