mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)
* Update Symfony lib to version ~6.4.0 * Update code missing return type * Add an iTop general configuration entry to store application secret (Symfony mandatory parameter) * Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
@@ -23,7 +23,7 @@ use Twig\Environment;
|
||||
*/
|
||||
class TemplateController
|
||||
{
|
||||
private $twig;
|
||||
private ?Environment $twig;
|
||||
|
||||
public function __construct(Environment $twig = null)
|
||||
{
|
||||
@@ -38,12 +38,12 @@ class TemplateController
|
||||
* @param int|null $sharedAge Max age for shared (proxy) caching
|
||||
* @param bool|null $private Whether or not caching should apply for client caches only
|
||||
* @param array $context The context (arguments) of the template
|
||||
* @param int $statusCode The HTTP status code to return with the response. Defaults to 200
|
||||
* @param int $statusCode The HTTP status code to return with the response (200 "OK" by default)
|
||||
*/
|
||||
public function templateAction(string $template, int $maxAge = null, int $sharedAge = null, bool $private = null, array $context = [], int $statusCode = 200): Response
|
||||
{
|
||||
if (null === $this->twig) {
|
||||
throw new \LogicException('You cannot use the TemplateController if the Twig Bundle is not available.');
|
||||
throw new \LogicException('You cannot use the TemplateController if the Twig Bundle is not available. Try running "composer require symfony/twig-bundle".');
|
||||
}
|
||||
|
||||
$response = new Response($this->twig->render($template, $context), $statusCode);
|
||||
@@ -65,6 +65,9 @@ class TemplateController
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $statusCode The HTTP status code (200 "OK" by default)
|
||||
*/
|
||||
public function __invoke(string $template, int $maxAge = null, int $sharedAge = null, bool $private = null, array $context = [], int $statusCode = 200): Response
|
||||
{
|
||||
return $this->templateAction($template, $maxAge, $sharedAge, $private, $context, $statusCode);
|
||||
|
||||
Reference in New Issue
Block a user