private function getAvgCost(Entity\TruckOrder $order, $count) { $cost = array(); $cost['estimatedCost'] = $order->getEstimatedCost() ? $order->getEstimatedCost() / $count : 0; $cost['actualCost'] = $order->getActualCost() ? $order->getActualCost() / $count : 0; $cost['estimatedSecurityCost'] = $order->getEstimatedSecurityCost() ? $order->getEstimatedSecurityCost() / $count : 0; $cost['actualSecurityCost'] = $order->getActualSecurityCost() ? $order->getActualSecurityCost() / $count : 0; return $cost; }
private function defineStatus(Entity\TruckOrder $order) { //if order status Planned and driver-vehicle information not empty - return Confirmed status if ($order->getStatus()->getName() == 'Planned' && strlen($order->getDriver()) && strlen($order->getVehiclePlate())) { return $this->getStatus('Confirmed'); } if ($this->getDoctrine()->getRepository('AppTruckingBundle:TruckOrder')->isTruckOrderClosed($order)) { return $this->getStatus('Closed'); } return $order->getStatus(); }