/** * @param sfWebRequest $request * @return void */ public function execute($request) { $branch = BranchPeer::retrieveByPK($request->getParameter('branch')); $this->forward404Unless($branch, 'Branch Not Found'); $oldtStatus = $branch->getStatus(); $branch->setIsBlacklisted(true)->setReviewRequest(false)->save(); Branch::saveAction($this->getUser()->getId(), $branch->getRepositoryId(), $branch->getId(), $oldtStatus, $branch->getStatus()); $this->getResponse()->setContentType('application/json'); return $this->renderText(json_encode(array('status' => 'blacklisted'))); }
public function notifyStatus(sfEvent $event) { if (!$this->configure($event)) { return true; } switch ($this->arguments['type']) { case 'file': $file = $this->arguments['object']; $oldStatus = $this->arguments['old']; File::saveAction($this->subject->getUser()->getId(), $file->getBranch()->getRepositoryId(), $file->getBranchId(), $file->getId(), $oldStatus, $file->getStatus()); break; case 'branch': $branch = $this->arguments['object']; $oldStatus = $this->arguments['old']; Branch::saveAction($this->subject->getUser()->getId(), $branch->getRepositoryId(), $branch->getId(), $oldStatus, $branch->getStatus()); break; } return true; }