/** * Edit image * * @param array $imageInfo * integer id * string name * string description * integer category_id * string image * integer created * integer order * @param array $formData * string name * string description * string image * integer order * @param array $image * @return boolean|string */ public function editImage($imageInfo, array $formData, array $image = []) { try { $this->adapter->getDriver()->getConnection()->beginTransaction(); $update = $this->update()->table('miniphotogallery_image')->set($formData)->where(['id' => $imageInfo['id']]); $statement = $this->prepareStatementForSqlObject($update); $statement->execute(); // upload the image $this->uploadImage($imageInfo['id'], $image, $imageInfo['image']); $this->adapter->getDriver()->getConnection()->commit(); } catch (Exception $e) { $this->adapter->getDriver()->getConnection()->rollback(); ApplicationErrorLogger::log($e); return $e->getMessage(); } // fire the add image event MiniPhotoGalleryEvent::fireEditImageEvent($imageInfo['id']); return true; }