public function updateVehicles($old, $new)
 {
     $new = trim($new);
     $command = new StatsSearchCommand();
     $this->statsService->updateStatsByCriteria($command->setCriteria("vehicleNo")->setOldValue($old)->setNewValue($new));
     return Response::json("ok", 200);
 }
 /**
  * select distinct sofer, sum(distance) from tasks where vehicleNo<>'' group by sofer
  * or
  * select distinct vehicleNo, sum(distance) from tasks where vehicleNo<>'' group by vehicleNo
  * @param $command
  * @return TaskSearchCommand[]
  */
 public function findStatsByType($command)
 {
     $type = $command->getCriteria();
     $stats = array();
     $aggregatedResults = $this->getTaskRepository()->aggregateDistancePerCriteria($command);
     foreach ($aggregatedResults as $result) {
         $command = new StatsSearchCommand();
         array_push($stats, $command->setName($result[$type])->setDistance($result["distance"]));
     }
     return $stats;
 }