1 | <?php |
||
15 | class FormRequest |
||
16 | { |
||
17 | use ORMBehaviors\Timestampable\Timestampable; |
||
18 | |||
19 | const STATUS = ['pending', 'approved', 'rejected']; |
||
20 | const TYPE = ['personal day', 'overnight guest', 'sick day']; |
||
21 | |||
22 | /** |
||
23 | * @var int |
||
24 | * |
||
25 | * @ORM\Column(name="id", type="integer") |
||
26 | * @ORM\Id |
||
27 | * @ORM\GeneratedValue(strategy="AUTO") |
||
28 | */ |
||
29 | private $id; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | * @Assert\NotBlank() |
||
34 | * @Assert\Choice(FormRequest::TYPE) |
||
35 | * @ORM\Column(type="string", length=25) |
||
36 | * @Groups({"Detail"}) |
||
37 | */ |
||
38 | private $type; |
||
39 | |||
40 | /** |
||
41 | * @var string |
||
42 | * @Assert\NotBlank() |
||
43 | * @Assert\Type("string") |
||
44 | * @Assert\Length( |
||
45 | * max = 255 |
||
46 | * ) |
||
47 | * @ORM\Column(type="string", length=255) |
||
48 | * @Groups({"Detail"}) |
||
49 | */ |
||
50 | private $status; |
||
51 | |||
52 | /** |
||
53 | * @var User |
||
54 | * @Assert\Type("object") |
||
55 | * @Assert\Valid |
||
56 | * @ORM\ManyToOne(targetEntity="User", inversedBy="formRequests") |
||
57 | */ |
||
58 | private $user; |
||
59 | |||
60 | /** |
||
61 | * @var \DateTime |
||
62 | * @Assert\DateTime() |
||
63 | * @ORM\Column(type="datetime") |
||
64 | * @Groups({"Detail"}) |
||
65 | */ |
||
66 | private $date; |
||
67 | |||
68 | /** |
||
69 | * @var string |
||
70 | * |
||
71 | * @ORM\Column(type="string", nullable=true) |
||
72 | * @Assert\Length(min="5", max="100") |
||
73 | * @Groups({"Detail"}) |
||
74 | */ |
||
75 | private $reason; |
||
76 | |||
77 | public function __construct() |
||
81 | |||
82 | /** |
||
83 | * Get id. |
||
84 | * |
||
85 | * @return int |
||
86 | */ |
||
87 | 1 | public function getId() |
|
91 | |||
92 | /** |
||
93 | * Set type. |
||
94 | * |
||
95 | * @param $type |
||
96 | * |
||
97 | * @return FormRequest |
||
98 | */ |
||
99 | public function setType($type) |
||
107 | |||
108 | /** |
||
109 | * Get type. |
||
110 | * |
||
111 | * @return string |
||
112 | */ |
||
113 | 1 | public function getType() |
|
117 | |||
118 | /** |
||
119 | * Set status. |
||
120 | * |
||
121 | * @param string $status |
||
122 | * |
||
123 | * @return FormRequest |
||
124 | */ |
||
125 | public function setStatus($status) |
||
133 | |||
134 | /** |
||
135 | * Get status. |
||
136 | * |
||
137 | * @return string |
||
138 | */ |
||
139 | 1 | public function getStatus() |
|
143 | |||
144 | /** |
||
145 | * Set user. |
||
146 | * |
||
147 | * @param User $user |
||
148 | * |
||
149 | * @return FormRequest |
||
150 | */ |
||
151 | public function setUser(User $user) |
||
157 | |||
158 | /** |
||
159 | * Get user. |
||
160 | * |
||
161 | * @return User |
||
162 | */ |
||
163 | public function getUser() |
||
167 | |||
168 | /** |
||
169 | * Set date. |
||
170 | * |
||
171 | * @param \DateTime $date |
||
172 | * |
||
173 | * @return FormRequest |
||
174 | */ |
||
175 | public function setDate($date) |
||
181 | /** |
||
182 | * Get date. |
||
183 | * |
||
184 | * @return \DateTime |
||
185 | */ |
||
186 | 1 | public function getDate() |
|
190 | |||
191 | /** |
||
192 | * @return string |
||
193 | */ |
||
194 | 1 | public function getReason() |
|
198 | |||
199 | /** |
||
200 | * @param string $reason |
||
201 | * |
||
202 | * @return $this |
||
203 | */ |
||
204 | public function setReason($reason) |
||
210 | } |
||
211 |