DamienHarper/auditor-bundle

Doesn't work out of the box?

dmitryuk opened this issue · 17 comments

Q A
auditor-bundle version 5.0.3
PHP version 8.1.0
Database PostgreSQL

Summary

I'm trying to install the package without any configuration,

Current behavior

After installed and enabled I receive the error

  You have requested a non-existent parameter "dh_auditor.provider.doctrine.configuration".  

After some searching I found that I must define providers and entities.

dh_auditor:
  enabled: true
  providers:
    doctrine:
      entities:

Can we set doctrine as default provider if nothing other is set?

@dmitryuk well, it should work out of the box 🤔
A default config file is created by the flex recipe, it should contain

dh_auditor:
    enabled: true
    providers:
        doctrine:
            table_prefix: null
            table_suffix: '_audit'

Did you let flex execute recipes (at least auditor-bundle's one) at install time?

Just also checked that i dont have any entries since August after a Update. It is enabled.

@develth thanks for the feedback but I need a bit more info/context:

  • what was the version before update?
  • what's the current version you use now?
  • do you declare your entities as auditable using annotations? attributes?

what was the version before update?
I Updated in February from 3.4

what's the current version you use now?
4.2.0

do you declare your entities as auditable using annotations? attributes?
Using the packages dh_auditor.yaml via entites:

Think i got the issue.

i modify config in dev/dh_auditor.yaml Seems like it overwrites all. If i remove this file, it works and files get listed in viewer.

Did you let flex execute recipes (at least auditor-bundle's one) at install time?

I don't have Symfony flex installed in the project.

@develth thanks for the feedback. If I understand well, it works if you remove the config file but can you elaborate on "Seems like it overwrites all."

i have following Config Files:

  • config/dh_auditor.yaml
  • config/dev/dh_auditor.yaml
  • config/prod/dh_auditor.yaml
  • config/test/dh_auditor.yaml

Main and fulll Setup is in config/dh_auditor.yaml. In e.g. config/prod/dh_auditor.yaml i disable the viewer with this:

dh_auditor:
  providers:
    doctrine:
      viewer: false

This disables the auditor. When i delete the file, for this env it works again.

@develth disabling the viewer should not disable auditor. Viewer should not be loaded/available but entities activity should still be logged into audit tables.

Yes it should not disable it, and thats why i think its a bug :)

It also happens when i set viewer: true
I later test it with another setting. IMHO it always disables when something is within that file

@develth try to set breakpoint here and check if you have an exception
image

I currently test it with acessing https://localhost:443/audit
When env-related config file is not exisiting, all is shonw, if its existing a empty view is shown.

I also just set Debug Marks, i dont even get in thise EventSubscriber, when there is a env-related config file

Does a bundle enabled in bundles.php or Kernel.php for every env?

It runs in every env - but only when the env specific config file is not available or empty.

@dmitryuk @develth Do you still face the issue using latest release?

I close this issue. Feel free to reopen if needed.