Crée l'enregistrement dans la table tj_application_role.

@param string $name
@param string $route

@return Application
189279
public function createApplication(ObjectManager $om, $name, $route, $reference = null, $bundleName = null)
    {
        $canonicalName = strtolower(($reference === null) ? $name : $reference);
        $entity = $om->getRepository('CanalTPSamCoreBundle:Application')->findOneByCanonicalName($canonicalName);
        if (is_null($entity)) {
            $entity = new Application($name);
            $entity->setDefaultRoute($route);
            $entity->setCanonicalName($canonicalName);
            $entity->setBundleName($bundleName);

            $om->persist($entity);
        }

        $this->addReference('app-' . $entity->getCanonicalName(), $entity);
    }
596391
protected static function createPermission($name, $slug, $path)
    {
        $permissionModel = config('admin.database.permissions_model');

        $permissionModel::create([
            'name'      => $name,
            'slug'      => $slug,
            'http_path' => '/'.trim($path, '/'),
        ]);
    }
187178
public function addRoute(RouteInterface $route, string $name)
    {
        $this->routes[$name] = $route;

        return $this;
    }
1240276
public function alias($template, $name, $to)
	{
		$router = $this;
		return $this->connect($template, $name, function($request) use($router, $to) {
			return $router->controller($to)->execute($request);
		});
	}
10811
private function trackRoute(Route $route)
    {
        return $this->getModel()->newQuery()->firstOrCreate([
            'name'   => $this->getRouteName($route),
            'action' => $route->getActionName(),
        ])->getKey();
    }
967679
public function addRoute($route)
    {
        if (!$route instanceof Route && !is_array($route)) {
            throw new \LogicException('Route invalid. Expected Route instance or array.');
        } elseif ($route instanceof Route) {
            $name = $route->getName();
            if (isset($this->routes[$name])) {
                throw new \LogicException(sprintf('Trying to register two routes with the same name "%s"', $name));
            }
            $this->routes[$route->getName()] = $route;
        } elseif (is_array($route) && !count($route) == 4) {
            throw new \LogicException('Array Route invalid. Expected array(string|array method, string pattern, callback|string action, string name).');
        } else {
            list($methods, $patternUri, $action, $name) = array_values($route);
            
            $this->routes[$name] = new Route($methods, $patternUri, $action, $name);
        }
        
        return $this;
    }
239153
function(route, name) {
            var handler;
            if (_.isObject(route) && !_.isRegExp(route)) {
                _.each(route, function(callback, route) {
                    this.route(route, callback);
                }, this);
                return this;
            }

            handler = this[name];
            if (handler == null) {
                handler = function() {
                    var args = _.values(arguments);
                    args.unshift('route:'+name);
                    this.trigger.apply(this, args);
                };
            }

            /**
             * Router controller for this application
             *
             * @property router
             * @type {Router}
             */
            if (!this.router) this.router = new this.Router();
            this.router.route(route, name, _.bind(handler, this));
            return this;
        }
160220
static public function getRoute($name) {
        $route_by_name = isset(self::$_stored_names[$name]) ?
            self::$_stored_names[$name] :
            null;
        
        if (!is_null($route_by_name) && isset(self::$_stored_routes[$route_by_name])) {
            return self::$_stored_routes[$route_by_name];
        }

        return null;
    }
195287
public function add($name, Route $route)
    {
        unset($this->routes[$name]);

        $this->routes[$name] = $route;
    }
1349238
public function setConstraint($name, $regex)
    {
        foreach ($this->routes as $route)
            $route->setConstraint($name, $regex);
        return $this;
    }
295036
public static function register($name, $path, $controller, $parameters, $options=array()) {
		static::$routes[$name] = new static($name, $path, $controller, $parameters, $options);
	}
533746
public function setName($name)
    {
        if ($this->lock) {
            throw new Exception('Route cannot be modified');
        }

        if (empty($name)) {
            return $name;
        }

        //Add group name if any
        $groupName = implode('', Router::$groupsProps['name']);
        $this->name = $groupName . $name;

        //Register
        Router::getInstance()->registerNamedRoute($this);

        return $this;
    }
850476
public function add($route)
    {
        if (!$route instanceof Route) {
            $route = new Route($route);
        }

        return $this->addRoute($route);
    }
973415
public function route($name, $parameters = array(), $absolute = true, $route = null)
    {
        if($path = $this->getPathFinder()->toRouteName($name, $parameters)){
            if($absolute){
                return $this->to($path);
            }
            return $path;
        }

        return parent::route($name, $parameters, $absolute, $route);
    }
1347982
public function add($name, RouteInterface $route)
    {
        $this->routes[(string) $name] = $route;

        return $this;
    }
1126694
private function compileRoute(Route $route, string $name, bool $checkHost): string
    {
        $code = '';
        $compiledRoute = $route->compile();
        $conditions = [];
        $matches = (bool) $compiledRoute->getPathVariables();
        $hostMatches = (bool) $compiledRoute->getHostVariables();
        $methods = array_flip($route->getMethods());

        if ($route->getCondition()) {
            $expression = $this->getExpressionLanguage()->compile($route->getCondition(), ['context', 'request']);

            if (false !== strpos($expression, '$request')) {
                $conditions[] = '($request = $request ?? $this->request ?: $this->createRequest($pathinfo))';
            }
            $conditions[] = $expression;
        }

        if (!$checkHost || !$compiledRoute->getHostRegex()) {
            // no-op
        } elseif ($hostMatches) {
            $conditions[] = sprintf('preg_match(%s, $host, $hostMatches)', self::export($compiledRoute->getHostRegex()));
        } else {
            $conditions[] = sprintf('%s === $host', self::export($route->getHost()));
        }

        $conditions = implode(' && ', $conditions);

        if ($conditions) {
            $code .= <<<EOF
        // $name
        if ($conditions) {

EOF;
        } else {
            $code .= "            // {$name}\n";
        }

        $gotoname = 'not_' . preg_replace('/[^A-Za-z0-9_]/', '', $name);

        // the offset where the return value is appended below, with indendation
        $retOffset = 12 + \strlen($code);
        $defaults = $route->getDefaults();
        if (isset($defaults['_canonical_route'])) {
            $name = $defaults['_canonical_route'];
            unset($defaults['_canonical_route']);
        }

        // optimize parameters array
        if ($matches || $hostMatches) {
            $vars = ["array('_route' => '$name')"];
            if ($matches || ($hostMatches && !$checkHost)) {
                $vars[] = '$matches';
            }
            if ($hostMatches && $checkHost) {
                $vars[] = '$hostMatches';
            }

            $code .= sprintf(
                "            \$ret = \$this->mergeDefaults(%s, %s);\n",
                implode(' + ', $vars),
                self::export($defaults)
            );
        } elseif ($defaults) {
            $code .= sprintf("            \$ret = %s;\n", self::export(['_route' => $name] + $defaults));
        } else {
            $code .= sprintf("            \$ret = array('_route' => '%s');\n", $name);
        }

        if ($methods) {
            $methodVariable = isset($methods['GET']) ? '$canonicalMethod' : '$requestMethod';
            $methods = self::export($methods);
        }

        if ($schemes = $route->getSchemes()) {
            $schemes = self::export(array_flip($schemes));
            if ($methods) {
                $code .= <<<EOF
            \$requiredSchemes = $schemes;
            \$hasRequiredScheme = isset(\$requiredSchemes[\$context->getScheme()]);
            if (!isset((\$a = {$methods})[{$methodVariable}])) {
                if (\$hasRequiredScheme) {
                    \$allow += \$a;
                }
                goto $gotoname;
            }
            if (!\$hasRequiredScheme) {
                \$allowSchemes += \$requiredSchemes;
                goto $gotoname;
            }


EOF;
            } else {
                $code .= <<<EOF
            \$requiredSchemes = $schemes;
            if (!isset(\$requiredSchemes[\$context->getScheme()])) {
                \$allowSchemes += \$requiredSchemes;
                goto $gotoname;
            }


EOF;
            }
        } elseif ($methods) {
            $code .= <<<EOF
            if (!isset((\$a = {$methods})[{$methodVariable}])) {
                \$allow += \$a;
                goto $gotoname;
            }


EOF;
        }

        if ($schemes || $methods) {
            $code .= "            return \$ret;\n";
        } else {
            $code = substr_replace($code, 'return', $retOffset, 6);
        }
        if ($conditions) {
            $code .= "        }\n";
        } elseif ($schemes || $methods) {
            $code .= '    ';
        }

        if ($schemes || $methods) {
            $code .= "        $gotoname:\n";
        }

        return $conditions ? $this->indent($code) : $code;
    }
431121
public static function register($name, $path, $controller, $methods=null, $restrictTo=null, $defaultResponse, $options=array()) {
		if( $methods && !is_array($methods) ) {
			$methods = array($methods);
		}
		foreach( static::$knownMethods as $method ) {
			if( (!$methods && !empty(static::$routes[$name][$method])) || ($methods && !in_array($method, $methods)) ) {
				continue;
			}
			static::$routes[$name][$method] = new static($name, $path, $controller, $method, $restrictTo, $defaultResponse, $options);
		}
	}