/** * Return # of specific timeslot * * @param Timeslot $timeslot * @return integer */ function getTimeslotNum(Timeslot $timeslot) { $timeslots = $this->getTimeslots(); if (is_array($timeslots)) { $counter = 0; foreach ($timeslots as $object_timeslot) { $counter++; if ($timeslot->getId() == $object_timeslot->getId()) { return $counter; } } } return 0; }