]> Raphaël G. Git Repositories - userbundle/blob - Entity/Civility.php
Add strict type
[userbundle] / Entity / Civility.php
1 <?php declare(strict_types=1);
2
3 /*
4 * This file is part of the Rapsys PackBundle package.
5 *
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Rapsys\UserBundle\Entity;
13
14 use Doctrine\Common\Collections\ArrayCollection;
15
16 use Rapsys\UserBundle\Entity\User;
17
18 /**
19 * Civility
20 */
21 class Civility {
22 /**
23 * @var integer
24 */
25 protected $id;
26
27 /**
28 * @var string
29 */
30 protected $title;
31
32 /**
33 * @var \DateTime
34 */
35 protected $created;
36
37 /**
38 * @var \DateTime
39 */
40 protected $updated;
41
42 /**
43 * @var ArrayCollection
44 */
45 protected $users;
46
47 /**
48 * Constructor
49 */
50 public function __construct() {
51 $this->users = new ArrayCollection();
52 }
53
54 /**
55 * Get id
56 *
57 * @return integer
58 */
59 public function getId(): int {
60 return $this->id;
61 }
62
63 /**
64 * Set title
65 *
66 * @param string $title
67 *
68 * @return Civility
69 */
70 public function setTitle(string $title) {
71 $this->title = $title;
72
73 return $this;
74 }
75
76 /**
77 * Get title
78 *
79 * @return string
80 */
81 public function getTitle(): ?string {
82 return $this->title;
83 }
84
85 /**
86 * Set created
87 *
88 * @param \DateTime $created
89 *
90 * @return Civility
91 */
92 public function setCreated(\DateTime $created) {
93 $this->created = $created;
94
95 return $this;
96 }
97
98 /**
99 * Get created
100 *
101 * @return \DateTime
102 */
103 public function getCreated(): \DateTime {
104 return $this->created;
105 }
106
107 /**
108 * Set updated
109 *
110 * @param \DateTime $updated
111 *
112 * @return Civility
113 */
114 public function setUpdated(\DateTime $updated) {
115 $this->updated = $updated;
116
117 return $this;
118 }
119
120 /**
121 * Get updated
122 *
123 * @return \DateTime
124 */
125 public function getUpdated(): \DateTime {
126 return $this->updated;
127 }
128
129 /**
130 * Add user
131 *
132 * @param User $user
133 *
134 * @return Civility
135 */
136 public function addUser(User $user): Civility {
137 $this->users[] = $user;
138
139 return $this;
140 }
141
142 /**
143 * Remove user
144 *
145 * @param User $user
146 */
147 public function removeUser(User $user) {
148 $this->users->removeElement($user);
149 }
150
151 /**
152 * Get users
153 *
154 * @return ArrayCollection
155 */
156 public function getUsers(): ArrayCollection {
157 return $this->users;
158 }
159
160 /**
161 * Returns a string representation of the title
162 *
163 * @return string
164 */
165 public function __toString(): string {
166 return $this->title;
167 }
168 }