You are here

function appointment_calendar_slot_capacity_value in Appointment Calendar 8

Same name and namespace in other branches
  1. 7 appointment_calendar.module \appointment_calendar_slot_capacity_value()

Implements function to get slot.

2 calls to appointment_calendar_slot_capacity_value()
AppointmentCalendarEditForm::buildForm in src/Form/AppointmentCalendarEditForm.php
Form constructor.
AppointmentCalendarEditForm::validateForm in src/Form/AppointmentCalendarEditForm.php
Form validation handler.

File

./appointment_calendar.module, line 186

Code

function appointment_calendar_slot_capacity_value($date, $time_slot) {
  $db_conn = \Drupal::database();
  $slot_query = $db_conn
    ->select('appointment_slots', 'ap');
  $slot_query
    ->fields('ap', [
    'slot',
  ]);
  $slot_query
    ->condition('slot', $time_slot, '=');
  $slot_query
    ->condition('date', $date, '=');
  $slot_result = $slot_query
    ->execute()
    ->fetchAll();
  return count($slot_result);
}