public function editAction() { if (!$this->_helper->requireAuth()->setAuthParams(null, null, 'photo.edit')->isValid()) { return; } $photo = Engine_Api::_()->core()->getSubject(); $this->view->form = $form = new Classified_Form_Photo_Edit(); if (!$this->getRequest()->isPost()) { $form->populate($photo->toArray()); return; } if (!$form->isValid($this->getRequest()->getPost())) { return; } // Process $db = Engine_Api::_()->getDbtable('photos', 'group')->getAdapter(); $db->beginTransaction(); try { $photo->setFromArray($form->getValues())->save(); $db->commit(); } catch (Exception $e) { $db->rollBack(); throw $e; } return $this->_forward('success', 'utility', 'core', array('messages' => array('Changes saved'), 'layout' => 'default-simple', 'parentRefresh' => true, 'closeSmoothbox' => true)); }