src/Services/FutureOfficeAppointmentsThatAreAvailable.php line 32

Open in your IDE?
  1. <?php
  2. namespace App\Services;
  3. use App\Entity\User;
  4. use App\Repository\OfficeAppointmentsRepository;
  5. class FutureOfficeAppointmentsThatAreAvailable
  6. {
  7.     public function countAppointments\DateTimeInterface $dateint $time)
  8.     {
  9.         $all_appointments $this->officeAppointmentsRepository->findBy([
  10.             'date' => $date,
  11.             'time' => $time,
  12.             'client'=> null
  13.         ]);
  14.         $bookings = [];
  15.         foreach ($all_appointments as $booking) {
  16.             $bookings[] = $booking;
  17.         }
  18.         if ($bookings) {
  19.             return count($bookings);
  20.         } else {
  21.             return count($bookings);
  22.         }
  23.     }
  24.     public function __construct(OfficeAppointmentsRepository $officeAppointmentsRepository)
  25.     {
  26.         $this->officeAppointmentsRepository $officeAppointmentsRepository;
  27.     }
  28. }