public function editarAction() { $id = $this->_request->getParam('id'); require_once APPLICATION_PATH . '/modules/admin/forms/Ingrediente.php'; $this->view->form = new admin_Form_Ingrediente(); $ingredienteModel = new Application_Model_Ingrediente(); if ($this->_request->isPost()) { $this->view->form->setDefaults($this->_request->getPost()); $data = $this->view->form->getValues(); if ($this->view->form->isValid($data)) { $ingredienteModel->update($data, 'id_ingrediente = ' . $id); return $this->_helper->redirector('index'); } } $ingrediente = $ingredienteModel->find($id)->current(); $this->view->form->setDefaults($ingrediente->toArray()); }