Example #1
0
 /**
  * @param Controller $Controller
  */
 public function addResourcesForController(Controller\Controller $Controller)
 {
     $sController = strtolower($Controller->getClass());
     // index
     if ($Controller->doesMethodExist('index')) {
         $this->addRoute(array('type' => \Concept\Core\RequestMethod::GET, 'route' => "/{$sController}", 'controller' => $sController, 'method' => 'index'));
     }
     // add
     if ($Controller->doesMethodExist('add')) {
         $this->addRoute(array('type' => \Concept\Core\RequestMethod::GET, 'route' => "/{$sController}/add", 'controller' => $sController, 'method' => 'add'));
     }
     if ($Controller->doesMethodExist('create')) {
         $this->addRoute(array('type' => \Concept\Core\RequestMethod::POST, 'route' => "/{$sController}/create", 'controller' => $sController, 'method' => 'create'));
     }
     // show
     if ($Controller->doesMethodExist('show')) {
         $this->addRoute(array('type' => \Concept\Core\RequestMethod::GET, 'route' => "/{$sController}/:id", 'controller' => $sController, 'method' => 'show'));
     }
     // edit
     if ($Controller->doesMethodExist('edit')) {
         $this->addRoute(array('type' => \Concept\Core\RequestMethod::GET, 'route' => "/{$sController}/:id/edit", 'controller' => $sController, 'method' => 'edit'));
     }
     // update
     if ($Controller->doesMethodExist('update')) {
         $this->addRoute(array('type' => \Concept\Core\RequestMethod::POST, 'route' => "/{$sController}/:id", 'controller' => $sController, 'method' => 'update'));
     }
     // destroy
     if ($Controller->doesMethodExist('delete')) {
         $this->addRoute(array('type' => \Concept\Core\RequestMethod::DELETE, 'route' => "/{$sController}/:id", 'controller' => $sController, 'method' => 'delete'));
     }
 }