Closed hackzilla closed 1 year ago
I've had a little dig and I can't see any reason and a blank project doesn't appear to cause this issue. Even looked at the order of the complierPasses.
We aren't using auditable in test, and disabling it in test config didn't help.
dh_auditor:
enabled: false
If it helps we have the following dependancies installed:
I've had a little dig and I can't see any reason and a blank project doesn't appear to cause this issue. Even looked at the order of the complierPasses.
We aren't using auditable in test, and disabling it in test config didn't help.
dh_auditor: enabled: false
If it helps we have the following dependancies installed:
- api-platform/core
- aws/aws-sdk-php
- doctrine/doctrine-bundle
- doctrine/mongodb-odm-bundle
- fresh/doctrine-enum-bundle
- symfony 6.2
- vich/uploader-bundle
I have the same bug, when running my tests KernelTestcase
@mkldevops We solved the issue by using composer patches. Though it would be nice to get to the root cause of the issue.
diff --git a/src/DHAuditorBundle.php b/src/DHAuditorBundle.php
index 8221eb9..6aa12f9 100644
--- a/src/DHAuditorBundle.php
+++ b/src/DHAuditorBundle.php
@@ -21,7 +21,7 @@ class DHAuditorBundle extends Bundle
parent::build($container);
$container->addCompilerPass(new AddProviderCompilerPass());
- $container->addCompilerPass(new DoctrineProviderConfigurationCompilerPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 1);
+ $container->addCompilerPass(new DoctrineProviderConfigurationCompilerPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
$container->addCompilerPass(new CustomConfigurationCompilerPass());
}
}
@hackzilla Doesn't work
I disabled the bundle on test environment
@mkldevops I couldn't figure out how to disable it, as it kept throwing the error.
Did you try @Marmelatze solution? @see https://github.com/DamienHarper/auditor/issues/141#issuecomment-1397949309
Did you try @Marmelatze solution? @see DamienHarper/auditor#141 (comment)
Doesn't seem like a solution, but a workaround. Ghost objects and lazy loading are for performance (even on test env). Are there any plans to support ghost objects?
Did you try @Marmelatze solution? @see DamienHarper/auditor#141 (comment)
@DamienHarper This worked for me. I'll close this ticket, in favour of that ticket.
@DamienHarper Whilst it fixed cache clearing, it broke a bunch of stuff in out test suite. For the moment, I'll go back to using my composer patch.
auditor-bundle
versionSummary
When clearing caches on test env auditor gets null when retrieving the EventManager. This issue appears to have been discussed in https://github.com/DamienHarper/auditor/issues/141
Current behavior
Clearing the cache in test env throws an null on
$entityManager->getEventManager()
inDoctrineProvider
How to reproduce
The specific commit that is causing the issue is: https://github.com/DamienHarper/auditor-bundle/commit/3f31c91b9406ef5c2ffc005d15241f8798bce6ff
If I revert DHAuditorBundle compiler pass back to what it was before the commit, then it starts working again for us.
This is the case for 5.2.2 & 5.2.4 The issue did not occur in 5.2.1
Expected behavior
Caches should be cleared without error.