예제 #1
0
	public function getDelivery()
	{
		$result = self::createQuery('deliveryforitem')
			->setKey($this->getId())
			->execute();
		return Delivery::find($result[0]['id']);
	}
	/**
	 * Returns all Routes w.r.t. it's Delivery
	 * @throws ControllerException
	 * @return string
	 */
	public function executeRoutes()
	{
		if (!$this->getRequest()->isXmlHttpRequest()) {
			throw new ControllerException("Method not allowed.");
		}
		$delivery = Delivery::find($this->getRequest()->get('id'));
		return json_encode($delivery->getRoutes());
	}