DamienHarper / auditor-bundle

The missing audit log library
MIT License
399 stars 121 forks source link

Doesn't work out of the box? #325

Closed dmitryuk closed 1 year ago

dmitryuk commented 2 years ago
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?

DamienHarper commented 2 years ago

@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?

develth commented 2 years ago

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

DamienHarper commented 2 years ago

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

develth commented 2 years ago

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:

develth commented 2 years ago

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.

dmitryuk commented 2 years ago

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.

DamienHarper commented 2 years ago

@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."

develth commented 2 years ago

i have following Config Files:

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.

DamienHarper commented 2 years ago

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

develth commented 2 years ago

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

develth commented 2 years ago

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

dmitryuk commented 2 years ago

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

develth commented 2 years ago

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

dmitryuk commented 2 years ago

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

develth commented 2 years ago

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

DamienHarper commented 1 year ago

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

DamienHarper commented 1 year ago

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