1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* Copyright (C) 2020-2024 Iain Cambridge |
7
|
|
|
* |
8
|
|
|
* This program is free software: you can redistribute it and/or modify |
9
|
|
|
* it under the terms of the GNU General Public License as published by |
10
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
11
|
|
|
* (at your option) any later version. |
12
|
|
|
* |
13
|
|
|
* This program is distributed in the hope that it will be useful, |
14
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
|
|
|
* GNU General Public License for more details. |
17
|
|
|
* |
18
|
|
|
* You should have received a copy of the GNU General Public License |
19
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace Parthenon\User\Entity; |
23
|
|
|
|
24
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
25
|
|
|
use Doctrine\Common\Collections\Collection; |
26
|
|
|
|
27
|
|
|
class Team implements TeamInterface |
28
|
|
|
{ |
29
|
|
|
protected $id; |
30
|
|
|
protected Collection $members; |
31
|
|
|
private \DateTime $createdAt; |
32
|
|
|
private ?\DateTime $updatedAt; |
33
|
|
|
private ?\DateTime $deletedAt; |
34
|
|
|
private ?string $name = ''; |
35
|
|
|
private bool $enabled = true; |
36
|
|
|
private string $billingEmail; |
37
|
|
|
|
38
|
|
|
public function __construct() |
39
|
|
|
{ |
40
|
|
|
$this->members = new ArrayCollection(); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function setId($id) |
44
|
|
|
{ |
45
|
|
|
$this->id = $id; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function getId() |
49
|
|
|
{ |
50
|
|
|
return $this->id; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @return MemberInterface[] |
55
|
|
|
*/ |
56
|
|
|
public function getMembers(): array |
57
|
|
|
{ |
58
|
|
|
return $this->members->getValues(); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function getTeamSize(): int |
62
|
|
|
{ |
63
|
|
|
return count($this->members); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function hasMember(MemberInterface $member): bool |
67
|
|
|
{ |
68
|
|
|
return $this->members->contains($member); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function addMember(MemberInterface $member): TeamInterface |
72
|
|
|
{ |
73
|
|
|
$this->members->add($member); |
74
|
|
|
|
75
|
|
|
return $this; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function getCreatedAt(): \DateTime |
79
|
|
|
{ |
80
|
|
|
return $this->createdAt; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function setCreatedAt(\DateTime $createdAt): self |
84
|
|
|
{ |
85
|
|
|
$this->createdAt = $createdAt; |
86
|
|
|
|
87
|
|
|
return $this; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function getUpdatedAt(): ?\DateTime |
91
|
|
|
{ |
92
|
|
|
return $this->updatedAt; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
public function setUpdatedAt(?\DateTime $updatedAt): self |
96
|
|
|
{ |
97
|
|
|
$this->updatedAt = $updatedAt; |
98
|
|
|
|
99
|
|
|
return $this; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
public function getDeletedAt(): ?\DateTime |
103
|
|
|
{ |
104
|
|
|
return $this->deletedAt; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
public function setDeletedAt(?\DateTime $deletedAt): self |
108
|
|
|
{ |
109
|
|
|
$this->deletedAt = $deletedAt; |
110
|
|
|
|
111
|
|
|
return $this; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function getName(): ?string |
115
|
|
|
{ |
116
|
|
|
return $this->name; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function setName(?string $name): void |
120
|
|
|
{ |
121
|
|
|
$this->name = $name; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
public function isEnabled(): bool |
125
|
|
|
{ |
126
|
|
|
return $this->enabled; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
public function setEnabled(bool $enabled): void |
130
|
|
|
{ |
131
|
|
|
$this->enabled = $enabled; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
public function getBillingEmail(): string |
135
|
|
|
{ |
136
|
|
|
return $this->billingEmail; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
public function setBillingEmail(string $billingEmail): void |
140
|
|
|
{ |
141
|
|
|
$this->billingEmail = $billingEmail; |
142
|
|
|
} |
143
|
|
|
} |
144
|
|
|
|