diff --git a/src/ControllerTrait.php b/src/ControllerTrait.php index 5be7d54..fc3264d 100644 --- a/src/ControllerTrait.php +++ b/src/ControllerTrait.php @@ -47,10 +47,15 @@ trait ControllerTrait { return $this->renderJson( array_filter($data ?? [], function($row) { return $row !== null; })); } + public function renderRawView(string $view, ?array $variables = null) : string + { + return $this->picea->renderHtml($view, $variables ?? [], $this); + } + public function renderView(string $view, ?array $variables = null) : ResponseInterface { return static::renderHtml( - $this->picea->renderHtml($view, $variables ?? [], $this) + $this->renderRawView($view, $variables ?? []) ); } diff --git a/src/Routing.php b/src/Routing.php index 4e0c4ce..01f863b 100644 --- a/src/Routing.php +++ b/src/Routing.php @@ -66,7 +66,6 @@ class Routing { foreach((array) ( $annotation->method ?? $annotation->methods ) as $method) { # Mapping every URLs from annotations in searched folders (Api, Controller, etc...) - $route->map(strtoupper($method), $annotation->getRoute(), function (ServerRequestInterface $request, array $arguments) use ( $container, $route, $annotation ) : ResponseInterface