Example #1
0
 public function getChosenShipment()
 {
     /** @var RadioList $control */
     $control = $this->getComponent('shipment');
     list($shipmentType, $shipmentId) = explode('-', $control->getValue());
     $shipmentType = ShipmentType::createFromValue((int) $shipmentType);
     return $this->shipmentService->getById($shipmentType, (int) $shipmentId);
 }
Example #2
0
 public function actionDefault($id, $type)
 {
     if ($id !== null) {
         $type = (int) $type;
         if (!ShipmentType::isValidValue($type)) {
             throw new BadRequestException(sprintf('Unknown shipment type %d.', $type));
         }
         $this->shipment = $this->shipmentService->getById(ShipmentType::createFromValue($type), $id);
     }
     if ($this->shipment === null) {
         throw new BadRequestException(sprintf('Shipment with ID %d not found.', $id));
     }
 }