Browse Source

config audit bundle

Vincent GUFFON 3 years ago
parent
commit
c83960da30

+ 1 - 0
config/bundles.php

@@ -19,4 +19,5 @@ return [
     Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
     Symfony\Bundle\DebugBundle\DebugBundle::class => ['docker' => true],
     Symfony\Bundle\MercureBundle\MercureBundle::class => ['all' => true],
+    DH\AuditorBundle\DHAuditorBundle::class => ['all' => true],
 ];

+ 12 - 0
config/packages/dh_auditor.yaml

@@ -0,0 +1,12 @@
+# Full configuration reference available at:
+# https://damienharper.github.io/auditor-docs/docs/auditor-bundle/configuration/reference.html
+# todo : mettre en place le script de nettoyage automatique des audits (le chiffre est le nombre de mois) : bin/console audit:clean 12 --no-confirm
+dh_auditor:
+    timezone: 'Europe/Paris'
+    enabled: true
+    providers:
+        doctrine:
+            table_prefix: null
+            table_suffix: '_audit'
+            storage_services:
+                - '@doctrine.orm.audit_entity_manager'

+ 7 - 0
config/packages/doctrine.yaml

@@ -1,5 +1,6 @@
 doctrine:
     dbal:
+
         default_connection: default
         connections:
             default:
@@ -9,6 +10,10 @@ doctrine:
                 # either here or in the DATABASE_URL env var (see .env file)
                 server_version: '5.7'
 
+            audit:
+                url: '%env(resolve:DATABASE_AUDIT_URL)%'
+                server_version: '5.7'
+
             adminassos:
                 url: '%env(resolve:DATABASE_ADMINASSOS_URL)%'
 
@@ -37,5 +42,7 @@ doctrine:
                         dir: '%kernel.project_dir%/src/Entity'
                         prefix: 'App\Entity'
                         alias: App
+            audit:
+                connection: audit
             adminassos:
                 connection: adminassos

+ 3 - 0
config/routes/dh_auditor.yaml

@@ -0,0 +1,3 @@
+dh_auditor:
+    resource: "@DHAuditorBundle/Controller/"
+    type: auditor