- Added default values to routing
This commit is contained in:
		
							parent
							
								
									13d306aec9
								
							
						
					
					
						commit
						f462fcc597
					
				| @ -27,21 +27,13 @@ class Routing { | |||||||
|     ) { } |     ) { } | ||||||
| 
 | 
 | ||||||
|     public function registerRoute(ContainerInterface $container, string $urlBase) { |     public function registerRoute(ContainerInterface $container, string $urlBase) { | ||||||
|         #$this->registeredRoutes ??= [];
 |  | ||||||
| 
 |  | ||||||
|         $this->router->group(rtrim($urlBase, "/"), function (RouteGroup $route) use ($container) { |         $this->router->group(rtrim($urlBase, "/"), function (RouteGroup $route) use ($container) { | ||||||
|             foreach($this->fetchRoutesAttributes() as $attribute) { |             foreach($this->fetchRoutesAttributes() as $attribute) { | ||||||
|                 $this->eventManager->execute(Event\RoutingCompileRoutes::class, $this, $attribute); |                 $this->eventManager->execute(Event\RoutingCompileRoutes::class, $this, $attribute); | ||||||
| 
 | 
 | ||||||
|                 # Mapping every URLs from attributes in searched folders (Api, Controller, etc...)
 |                 # Mapping every URLs from attributes in searched folders (Api, Controller, etc...)
 | ||||||
|                 foreach((array) $attribute->method as $method) { |                 foreach((array) $attribute->method as $method) { | ||||||
|                     #if (! empty($this->registeredRoutes[$attribute->getRoute().$method])) {
 |                     $route->map(strtoupper($method), $attribute->getRegistrableRoute(), function (ServerRequestInterface $request, array $arguments) use ( | ||||||
|                     #     continue;
 |  | ||||||
|                     #}
 |  | ||||||
| 
 |  | ||||||
|                     #$this->registeredRoutes[$attribute->getRoute().$method] = true;
 |  | ||||||
| 
 |  | ||||||
|                     $route->map(strtoupper($method), $attribute->getRoute(), function (ServerRequestInterface $request, array $arguments) use ( |  | ||||||
|                         $container, $route, $attribute |                         $container, $route, $attribute | ||||||
|                     ) : ResponseInterface { |                     ) : ResponseInterface { | ||||||
|                         $class = $attribute->class; |                         $class = $attribute->class; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user