예제 #1
0
 /**
  * @param Request $request
  * @param integer $movement
  *
  * @return RedirectResponse
  */
 protected function move(Request $request, $movement)
 {
     $resource = $this->findOr404($request);
     $this->domainManager->move($resource, $movement);
     if ($this->config->isApiRequest()) {
         if ($resource instanceof ResourceEvent) {
             throw new HttpException($resource->getErrorCode(), $resource->getMessage());
         }
         return $this->handleView($this->view($resource, 204));
     }
     return $this->redirectHandler->redirectToIndex();
 }
예제 #2
0
 /**
  * @param Request $request
  * @param boolean $enabled
  *
  * @return RedirectResponse|Response
  */
 protected function toggle(Request $request, $enabled)
 {
     $this->isGrantedOr403('update');
     $resource = $this->findOr404($request);
     $resource->setEnabled($enabled);
     $this->domainManager->update($resource, $enabled ? 'enable' : 'disable');
     if ($this->config->isApiRequest()) {
         if ($resource instanceof ResourceEvent) {
             throw new HttpException($resource->getErrorCode(), $resource->getMessage());
         }
         return $this->handleView($this->view($resource, 204));
     }
     return $this->redirectHandler->redirectToIndex();
 }
예제 #3
0
 /**
  * @param Request $request
  * @param integer $movement
  *
  * @return RedirectResponse
  */
 protected function move(Request $request, $movement)
 {
     $resource = $this->findOr404($request);
     $this->domainManager->move($resource, $movement);
     return $this->redirectHandler->redirectToIndex();
 }