- Added a new RenderRawView without the default HTML reponse

This commit is contained in:
Dave M. 2021-03-10 13:55:58 +00:00
parent 01bb926ca7
commit 434e3c0c46
2 changed files with 6 additions and 2 deletions

View File

@ -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 ?? [])
);
}

View File

@ -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