1 | <?php |
||
15 | class BookingRepository implements BookingRepositoryInterface, ObjectRepository |
||
16 | { |
||
17 | |||
18 | /** |
||
19 | * @var \Doctrine\Common\Persistence\ObjectRepository |
||
20 | */ |
||
21 | protected $bookingRepository; |
||
22 | |||
23 | /** |
||
24 | * @param ObjectRepository $bookingRepository |
||
25 | */ |
||
26 | public function __construct(ObjectRepository $bookingRepository) |
||
30 | |||
31 | /** |
||
32 | * @param UserInterface $user |
||
33 | * @return array |
||
34 | */ |
||
35 | public function findAllByUser(UserInterface $user) |
||
44 | |||
45 | /** |
||
46 | * Find all bookings for a given user/month |
||
47 | * |
||
48 | * @param \ZfcUser\Entity\UserInterface $user |
||
49 | * @param DateTime $date |
||
50 | * @return Booking[] |
||
51 | */ |
||
52 | public function findByUserAndMonth(UserInterface $user, DateTime $date) |
||
73 | |||
74 | /** |
||
75 | * Check if this booking, is the first booking |
||
76 | * for this user + month |
||
77 | * |
||
78 | * @param UserInterface $user |
||
79 | * @param DateTime $month |
||
80 | * @return bool |
||
81 | */ |
||
82 | public function isUsersFirstBookingForMonth(UserInterface $user, DateTime $month) |
||
106 | |||
107 | /** |
||
108 | * Get the sum of all hours booked between the first day of the given month, |
||
109 | * and the current day of the passed in DateTime object |
||
110 | * |
||
111 | * @param UserInterface $user |
||
112 | * @param DateTime $date |
||
113 | * @return float |
||
114 | */ |
||
115 | public function getMonthBookedToDateTotalByUser(UserInterface $user, DateTime $date) |
||
142 | |||
143 | /** |
||
144 | * Get the sum of all all hours booked between the first day of the given month, |
||
145 | * and the last day of the month |
||
146 | * |
||
147 | * @param UserInterface $user |
||
148 | * @param DateTime $date |
||
149 | * @return float |
||
150 | */ |
||
151 | public function getMonthBookedTotalByUser(UserInterface $user, DateTime $date) |
||
178 | |||
179 | /** |
||
180 | * @param UserInterface $user |
||
181 | * @param DateTime $startDate |
||
182 | * @param DateTime $endDate |
||
183 | * @return float |
||
184 | */ |
||
185 | public function getTotalBookedBetweenByUser(UserInterface $user, DateTime $startDate, DateTime $endDate) |
||
209 | |||
210 | /** |
||
211 | * find(): defined by ObjectRepository. |
||
212 | * |
||
213 | * @see ObjectRepository::find() |
||
214 | * @param int $id |
||
215 | * @return Booking|null |
||
216 | */ |
||
217 | public function find($id) |
||
221 | |||
222 | /** |
||
223 | * findAll(): defined by ObjectRepository. |
||
224 | * |
||
225 | * @see ObjectRepository::findAll() |
||
226 | * @return Booking[] |
||
227 | */ |
||
228 | public function findAll() |
||
232 | |||
233 | /** |
||
234 | * findBy(): defined by ObjectRepository. |
||
235 | * |
||
236 | * @see ObjectRepository::findBy() |
||
237 | * @param array $criteria |
||
238 | * @param array|null $orderBy |
||
239 | * @param int|null $limit |
||
240 | * @param int|null $offset |
||
241 | * @return Booking[] |
||
242 | */ |
||
243 | public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) |
||
247 | |||
248 | /** |
||
249 | * findOneBy(): defined by ObjectRepository. |
||
250 | * |
||
251 | * @see ObjectRepository::findOneBy() |
||
252 | * @param array $criteria |
||
253 | * @return Booking|null |
||
254 | */ |
||
255 | public function findOneBy(array $criteria) |
||
259 | |||
260 | /** |
||
261 | * getClassName(): defined by ObjectRepository. |
||
262 | * |
||
263 | * @see ObjectRepository::getClassName() |
||
264 | * @return string |
||
265 | */ |
||
266 | public function getClassName() |
||
270 | } |
||
271 |