/**
  * @return Passenger
  */
 private function getFirstPassenger(DrivingPool $drivingPool)
 {
     /*
      * get the first passenger Id associated with the driving pool (or null)
      */
     /** @var DrivingMission $drivingMission */
     foreach ($drivingPool->getDrivingMissions() as $drivingMission) {
         /** @var DrivingOrder $drivingOrder */
         foreach ($drivingMission->getDrivingOrders() as $drivingOrder) {
             return $drivingOrder->getPassenger();
         }
         return null;
     }
     return null;
 }
 /**
  * Before removing a driving pool, it's children must be prepared:
  * +-- driving missions: remove association
  * +-- driving orders: if booked, set to over-booked
  *
  * @param DrivingPool $poolToRemove
  * @param array $messages
  * @return mixed
  */
 private function removeDrivingPoolChildren(DrivingPool $poolToRemove, &$messages)
 {
     /** @var  DrivingMissionRepository $drivingMissionRepository */
     $drivingMissionRepository = $this->container->get('drivingmission_repository');
     /** @var DrivingOrderRepository $drivingOrderRepository */
     $drivingOrderRepository = $this->container->get('drivingorder_repository');
     $drivingMissions = $poolToRemove->getDrivingMissions();
     /** @var DrivingMission $drivingMission */
     foreach ($drivingMissions as $drivingMission) {
         /* remove association with pool and store mission */
         $drivingMission->removeDrivingPool();
         $drivingMissionRepository->store($drivingMission);
         /* set associated driving orders as "overbooked" and store */
         $drivingOrders = $drivingMission->getDrivingOrders();
         /** @var DrivingOrder $drivingOrder */
         foreach ($drivingOrders as $drivingOrder) {
             $status = $drivingOrder->getStatus();
             if ($status == DrivingOrder::BOOKED) {
                 $drivingOrder->setStatus(DrivingOrder::OVERBOOKED);
                 $drivingOrderRepository->store($drivingOrder);
                 $messages[] = $this->getDrivingOrderString($drivingOrder);
             }
         }
     }
 }