public function editarAction()
 {
     $id = $this->_request->getParam('id');
     require_once APPLICATION_PATH . '/modules/admin/forms/Relacionamento.php';
     $this->view->form = new admin_Form_Relacionamento();
     $relacionamentosModel = new Application_Model_Relacionamentos();
     if ($this->_request->isPost()) {
         $this->view->form->setDefaults($this->_request->getPost());
         $data = $this->view->form->getValues();
         if ($this->view->form->isValid($data)) {
             $relacionamentosModel->update($data, 'id_ingrediente_idx = ' . $id);
             return $this->_helper->redirector('index');
         }
     }
     $relacionamento = $relacionamentosModel->find($id)->current();
     $this->view->form->setDefaults($relacionamento->toArray());
 }
 public function removerAction()
 {
     $id = $this->_request->getParam('id');
     $confirma = $this->_request->getParam('confirma');
     if (isset($confirma)) {
         if ($confirma == 1) {
             $ingredienteModel = new Application_Model_Ingrediente();
             $ingredienteModel->update(array('excluido' => '1'), 'id_ingrediente = ' . $id);
             $relacionamentosModel = new Application_Model_Relacionamentos();
             $relacionamentosModel->update(array('excluido' => '1'), 'id_ingrediente = ' . $id);
             return $this->_helper->redirector('index');
         } else {
             return $this->_helper->redirector('index');
         }
     } else {
         $this->view->id = $this->_request->getParam('id');
         $ingredienteModel = new Application_Model_Ingrediente();
         $nome_ingrediente = $ingredienteModel->fetchAll($ingredienteModel->select()->from($ingredienteModel->info(Zend_Db_Table_Abstract::NAME))->columns(array('nome_ingrediente'))->where('id_ingrediente = ?', $id));
         $this->view->ingrediente = $nome_ingrediente;
     }
 }