/** * Creates a new condominio */ public function createAction() { if (!$this->request->isPost()) { return $this->dispatcher->forward(array("controller" => "condominio", "action" => "index")); } $condominio = new Condominio(); $condominio->nombre = $this->request->getPost("nombre"); if (!$condominio->save()) { foreach ($condominio->getMessages() as $message) { $this->flash->error($message); } return $this->dispatcher->forward(array("controller" => "condominio", "action" => "new")); } $this->flash->success("condominio was created successfully"); return $this->dispatcher->forward(array("controller" => "condominio", "action" => "index")); }