예제 #1
0
 /**
  *
  * Gets a Route for generation.
  *
  * @param string $name Get this route name.
  *
  * @return Route
  *
  * @throws Exception\RouteNotFound when the named route does not exist.
  *
  */
 protected function getRouteForGenerate($name)
 {
     if (!$this->routes->offsetExists($name)) {
         throw new Exception\RouteNotFound($name);
     }
     return $this->routes->offsetGet($name);
 }
예제 #2
0
파일: Router.php 프로젝트: Umz/ImpressPages
 /**
  * 
  * Looks up a route by name, and interpolates data into it to return
  * a URI path.
  * 
  * @param string $name The route name to look up.
  * 
  * @param array $data The data to interpolate into the URI; data keys
  * map to param tokens in the path.
  * 
  * @return string|false A URI path string if the route name is found, or
  * boolean false if not.
  * 
  */
 public function generate($name, $data = null)
 {
     if (!$this->routes->offsetExists($name)) {
         throw new Exception\RouteNotFound($name);
     }
     return $this->routes->offsetGet($name)->generate($data);
 }
예제 #3
0
 /**
  * 
  * Callable for `attachResource()` that adds resource routes.
  * 
  * @param RouteCollection $router A RouteCollection, probably $this.
  * 
  * @return null
  * 
  */
 protected function resourceCallable(RouteCollection $router)
 {
     // add 'id' and 'format' if not already defined
     $tokens = array();
     if (!isset($router->tokens['id'])) {
         $tokens['id'] = '\\d+';
     }
     if (!isset($router->tokens['format'])) {
         $tokens['format'] = '(\\.[^/]+)?';
     }
     if ($tokens) {
         $router->addTokens($tokens);
     }
     // add the routes
     $router->addGet('browse', '{format}');
     $router->addGet('read', '/{id}{format}');
     $router->addGet('edit', '/{id}/edit{format}');
     $router->addGet('add', '/add');
     $router->addDelete('delete', '/{id}');
     $router->addPost('create', '');
     $router->addPatch('update', '/{id}');
     $router->addPut('replace', '/{id}');
 }
예제 #4
0
파일: Router.php 프로젝트: Umz/ImpressPages
 public function generate($name, $data = array())
 {
     return $this->auraRouter->generate($name, $data);
 }