/** -------------------------
  * Assign a vehicle to a driver and driving pool(s).
  * Check resource availability and compatibility with driver preferences,
  * if applicable register the resource(s) and assign vehicle to the
  * specified driving pool(s).
  *
  * @param DispositionResourcesDTO $dto
  * @param Shift[] $shifts
  * @return bool success = true
  */
 public function assignVehicleToDriverAndDrivingPools(DispositionResourcesDTO $dto, array $shifts)
 {
     $vehicle = null;
     $driver = $dto->getDriver();
     if ($driver->hasSupervisedVehicles()) {
         $vehicle = $this->findAvailableSupervisedVehicle($dto);
     }
     if (null === $vehicle) {
         $vehicle = $this->findAvailableRandomVehicle($dto);
     }
     if (null !== $vehicle) {
         $this->assignVehicleToDrivingPools($vehicle, $dto);
         return true;
     }
     return false;
 }