/** * @deprecated */ public function executeCreate() { $errors = array(); $validator = new ItemValidator(); $name = $this->app->escape($this->getRequest()->get('name')); $tempMin = $this->app->escape($this->getRequest()->get('tempMin')); $tempMax = $this->app->escape($this->getRequest()->get('tempMax')); $errors = $validator->validateSingleItem($name, $tempMin, $tempMax); $item = new Item(); $item->setName($name); $item->setTempMin($tempMin); $item->setTempMax($tempMax); if (count($errors) == 0) { $item->save(); return $this->redirect('/item/view/' . $item->getId()); } return $this->render('item.add.twig', array( 'item' => $item, 'errors' => $errors, 'form_action' => '/item/create', )); }
/** * getRoute() Utility Function * * Returns a new valid ItemRoute array * * @param Item $item * @param integer $rid * @return array */ private function newItemRoute($item, $rid) { return array( 'id' => $item->getId(), 'img' => Delivery::getMarkerImage($rid) ); }