public function addPrice() { if (null !== ($response = $this->checkAuth(array(AdminResources::MODULE), array('SoColissimo'), AccessManager::CREATE))) { return $response; } try { $form = new AddPriceForm($this->getRequest()); $data = $this->validateForm($form)->getData(); $newPrice = new SocolissimoPrice(); $newPrice->setAreaId($data['area'])->setDeliveryModeId($data['delivery_mode'])->setWeightMax($data['weight'])->setPrice($data['price'])->save(); } catch (\Exception $e) { $deliveryModeId = $this->getRequest()->request->get('socolissimo_price_create')['delivery_mode']; return $this->priceTabResponse($deliveryModeId, $e->getMessage()); } return $this->priceTabResponse($data['delivery_mode']); }
/** * Filter the query by a related \SoColissimo\Model\SocolissimoPrice object * * @param \SoColissimo\Model\SocolissimoPrice|ObjectCollection $socolissimoPrice the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildSocolissimoDeliveryModeQuery The current query, for fluid interface */ public function filterBySocolissimoPrice($socolissimoPrice, $comparison = null) { if ($socolissimoPrice instanceof \SoColissimo\Model\SocolissimoPrice) { return $this->addUsingAlias(SocolissimoDeliveryModeTableMap::ID, $socolissimoPrice->getDeliveryModeId(), $comparison); } elseif ($socolissimoPrice instanceof ObjectCollection) { return $this->useSocolissimoPriceQuery()->filterByPrimaryKeys($socolissimoPrice->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterBySocolissimoPrice() only accepts arguments of type \\SoColissimo\\Model\\SocolissimoPrice or Collection'); } }
/** * Exclude object from result * * @param ChildSocolissimoPrice $socolissimoPrice Object to remove from the list of results * * @return ChildSocolissimoPriceQuery The current query, for fluid interface */ public function prune($socolissimoPrice = null) { if ($socolissimoPrice) { $this->addUsingAlias(SocolissimoPriceTableMap::ID, $socolissimoPrice->getId(), Criteria::NOT_EQUAL); } return $this; }