Ejemplo n.º 1
0
 public function executeComment_post()
 {
     $message = mfwRequest::param('message');
     $package_id = mfwRequest::param('package_id');
     $con = mfwDBConnection::getPDO();
     $con->beginTransaction();
     try {
         $this->app = ApplicationDb::retrieveByPkForUpdate($this->app->getId());
         $comment = CommentDb::post($this->login_user, $this->app, $package_id, $message);
         $this->app->updateLastCommented($comment->getCreated());
         $con->commit();
     } catch (Exception $e) {
         error_log(__METHOD__ . '(' . __LINE__ . '): ' . get_class($e) . ":{$e->getMessage()}");
         $con->rollback();
         throw $e;
     }
     $owners = $this->app->getOwners();
     $owners->noticeNewComment($comment, $this->app);
     return $this->redirect('/app/comment', array('id' => $this->app->getId()));
 }
Ejemplo n.º 2
0
 public function executePreferences_update_owners()
 {
     $owners = mfwRequest::param('owners');
     $owners = array_filter($owners, 'strlen');
     // 自分自身は除外させない
     $owners[] = $this->login_user->getMail();
     $owners = array_unique($owners);
     $con = mfwDBConnection::getPDO();
     $con->beginTransaction();
     try {
         $this->app = ApplicationDb::retrieveByPkForUpdate($this->app->getId(), $con);
         $this->app->setOwners($owners, $con);
         $con->commit();
     } catch (Exception $e) {
         error_log(__METHOD__ . '(' . __LINE__ . '): ' . get_class($e) . ":{$e->getMessage()}");
         $con->rollback();
         throw $e;
     }
     return $this->redirect("/app/preferences?id={$this->app->getId()}#owners");
 }