src/Services/OfficeAppointmentsByClientForDateAndHour.php line 33

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