Avoid creating a new Twig instance, get it from the request set up in the middleware
This commit is contained in:
parent
f45c5a6551
commit
d45800cfc4
@ -32,7 +32,7 @@ abstract class Controller
|
|||||||
$this->response = $response;
|
$this->response = $response;
|
||||||
$this->args = $args;
|
$this->args = $args;
|
||||||
$this->routeContext = RouteContext::fromRequest($this->request);
|
$this->routeContext = RouteContext::fromRequest($this->request);
|
||||||
$this->view = Twig::fromRequest($request);
|
$this->view = $this->request->getAttribute('view');
|
||||||
|
|
||||||
return $this->handle();
|
return $this->handle();
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,14 @@
|
|||||||
|
|
||||||
namespace Slovocast\Infrastructure\Api\Database;
|
namespace Slovocast\Infrastructure\Api\Database;
|
||||||
|
|
||||||
|
use ReturnTypeWillChange;
|
||||||
|
|
||||||
interface DatabaseHandlerInterface
|
interface DatabaseHandlerInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return mixed The return must be an active connection to a database.
|
* @return mixed The return must be an active connection to a database.
|
||||||
*/
|
*/
|
||||||
|
#[ReturnTypeWillChange]
|
||||||
public function getConnection();
|
public function getConnection();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,7 +33,7 @@ class DatabaseHandler implements DatabaseHandlerInterface
|
|||||||
/**
|
/**
|
||||||
* @return PDO For this particular Handler we will return the PDO object
|
* @return PDO For this particular Handler we will return the PDO object
|
||||||
*/
|
*/
|
||||||
public function getConnection()
|
public function getConnection(): PDO
|
||||||
{
|
{
|
||||||
return $this->handle;
|
return $this->handle;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
namespace Slovocast;
|
namespace Slovocast;
|
||||||
|
|
||||||
use League\Config\Configuration;
|
use League\Config\Configuration;
|
||||||
use Odan\Session\Middleware\SessionStartMiddleware;
|
|
||||||
use Odan\Session\SessionInterface;
|
use Odan\Session\SessionInterface;
|
||||||
use Psr\Container\ContainerExceptionInterface;
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
|
Loading…
Reference in New Issue
Block a user