public function isValid($value) { $this->_setValue($value); $mapper = new Application_Model_PropertyMapper(); foreach ($mapper->fetchAll() as $property) { if ($property->getReference_no() == $value) { $this->_error(self::VALUE); return false; } } return true; }
public function indexAction() { $model = new Application_Model_PropertyMapper(); $properties = $model->fetchByIds(Misc_Utils::getFavorites()->getArrayCopy()); $count = count($properties); if ($count) { $this->view->count = $count; $this->view->properties = $properties; } else { $this->renderScript('my-favorites/no-results.phtml'); } }
public function saveFormAction() { $form = new Application_Form_PropertyForm(); $request = $this->getRequest(); $form->populate($request->getParams()); $this->view->form = $form; if ($this->getRequest()->isPost()) { if ($form->isValid($_POST)) { $values = new Application_Model_Property($form->getValues()); $mapper = new Application_Model_PropertyMapper(); $values->setArea(str_replace(",", ".", $values->getArea())); $values->setPrice(str_replace(",", ".", $values->getPrice())); $newId = $mapper->save($values); $this->_redirect("/property/detail/property/" . $newId); return; } } $this->renderScript("property/add.phtml"); }