Kaynağa Gözat

Surcharge page d'erreurs

François Drouhard 2 yıl önce
ebeveyn
işleme
6ef5968024

+ 3 - 1
composer.json

@@ -33,7 +33,9 @@
         "symfony/validator": "^5.4",
         "symfony/web-link": "^5.4",
         "symfony/webpack-encore-bundle": "^1.12",
-        "symfony/yaml": "^5.4"
+        "symfony/yaml": "^5.4",
+        "twig/extra-bundle": "^2.12|^3.0",
+        "twig/twig": "^2.12|^3.0"
     },
     "require-dev": {
         "phpunit/phpunit": "^9.5",

+ 80 - 1
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "7c31d52fd9cb376e551eb6c688ebfc8a",
+    "content-hash": "5831ae83a0b64e15a49eaea1d0198389",
     "packages": [
         {
             "name": "composer/package-versions-deprecated",
@@ -7355,6 +7355,85 @@
             ],
             "time": "2022-06-20T11:50:59+00:00"
         },
+        {
+            "name": "twig/extra-bundle",
+            "version": "v3.4.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/twigphp/twig-extra-bundle.git",
+                "reference": "2e58256b0e9fe52f30149347c0547e4633304765"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/2e58256b0e9fe52f30149347c0547e4633304765",
+                "reference": "2e58256b0e9fe52f30149347c0547e4633304765",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=7.2.5",
+                "symfony/framework-bundle": "^4.4|^5.0|^6.0",
+                "symfony/twig-bundle": "^4.4|^5.0|^6.0",
+                "twig/twig": "^2.7|^3.0"
+            },
+            "require-dev": {
+                "league/commonmark": "^1.0|^2.0",
+                "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0",
+                "twig/cache-extra": "^3.0",
+                "twig/cssinliner-extra": "^2.12|^3.0",
+                "twig/html-extra": "^2.12|^3.0",
+                "twig/inky-extra": "^2.12|^3.0",
+                "twig/intl-extra": "^2.12|^3.0",
+                "twig/markdown-extra": "^2.12|^3.0",
+                "twig/string-extra": "^2.12|^3.0"
+            },
+            "type": "symfony-bundle",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "3.2-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Twig\\Extra\\TwigExtraBundle\\": ""
+                },
+                "exclude-from-classmap": [
+                    "/Tests/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com",
+                    "homepage": "http://fabien.potencier.org",
+                    "role": "Lead Developer"
+                }
+            ],
+            "description": "A Symfony bundle for extra Twig extensions",
+            "homepage": "https://twig.symfony.com",
+            "keywords": [
+                "bundle",
+                "extra",
+                "twig"
+            ],
+            "support": {
+                "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.4.0"
+            },
+            "funding": [
+                {
+                    "url": "https://github.com/fabpot",
+                    "type": "github"
+                },
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/twig/twig",
+                    "type": "tidelift"
+                }
+            ],
+            "time": "2022-01-04T13:58:53+00:00"
+        },
         {
             "name": "twig/twig",
             "version": "v3.4.1",

+ 1 - 0
config/bundles.php

@@ -12,4 +12,5 @@ return [
     Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
     Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
     Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
+    Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
 ];

+ 0 - 3
config/routes/dev/twig.yaml

@@ -1,3 +0,0 @@
-_errors:
-    resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
-    prefix: /_error

+ 0 - 14
src/Controller/ErrorController.php

@@ -1,14 +0,0 @@
-<?php
-
-namespace App\Controller;
-
-use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
-
-class ErrorController extends AbstractController
-{
-    public function indexAction() {
-        
-        return $this->render('errors/404.html.twig');
-    }
-
-}

+ 3 - 0
symfony.lock

@@ -605,6 +605,9 @@
     "theseer/tokenizer": {
         "version": "1.2.0"
     },
+    "twig/extra-bundle": {
+        "version": "v3.4.0"
+    },
     "twig/twig": {
         "version": "v2.9.0"
     },

+ 2 - 2
templates/errors/404.html.twig → templates/bundles/TwigBundle/Exception/error404.html.twig

@@ -1,7 +1,7 @@
 {% extends "base.html.twig" %}
 
-{% block title %}{{ parent() }} - Ajouter un genre{% endblock %}
+{% block title %}{{ parent() }}Erreur 404{% endblock %}
 {% block titre %}Erreur 404{% endblock %}
 {% block body %}
-   <p>La page demandée n'existe pas, il faut aller voir ailleurs.</p>
+   <p>La page demandée n'existe pas, il faut aller voir ailleurs petit lapin.</p>
 {% endblock %}

+ 8 - 0
templates/bundles/TwigBundle/Exception/error500.html.twig

@@ -0,0 +1,8 @@
+{% extends "base.html.twig" %}
+
+{% block title %}{{ parent() }}Erreur 500{% endblock %}
+{% block titre %}Erreur 500{% endblock %}
+{% block body %}
+   <p>Une erreur serveur s'est glissée dans le bouzin !</p>
+   <p>Vous savez où me contacter pour que je répare mes conneries.</p>
+{% endblock %}