Closed nalxnet closed 1 year ago
@nalxnet should be fixed now with 2.3.1
, thanks for the feedback!
Thanks for the quick fix, will test this in my code once its used by https://github.com/DamienHarper/auditor-bundle
It should already be the case, auditor-bundle
version 5.2.0
targets auditor
version ^2.3
which means >= 2.3.0
and < 2.4.0
Just run composer update
and it should do the trick
You're absolutely right, thanks. Tested it but unfortunately the exception is still thrown because SchemaManager::createAuditTable is still called with the untracked parent entity and not the tracked child entity. Looks like https://github.com/DamienHarper/auditor/pull/139 will fix this.
@nalxnet 2.4.0
is out and fixes this issue. Sorry for the inconvenience and kudos to @dmitryuk.
Thanks, but since it's a new minor release I'll have to wait for a new auditor-bundle
release this time. 😄
@nalxnet kindly run ’composer u damienharper/auditor’
^2.3 which means >= 2.3.0 and < 3.0.0 as I know
You're absolutely right, I got confused by @DamienHarper 's comment above. It's working again without errors. Again, thanks a lot for the quick fix! 👍
auditor
versionSummary
I have an abstract parent entity which is not audited, but uses doctrine/orm inheritance type "SINGLE_TABLE" and defines the database table for its child entities. Some child entities are configured to be audited.
With auditor 2.3.0, creating the audit database schema throws an exception.
Current behavior
When the database schema is created for this abstract parent entity, the CreateSchemaListener wants to create the corresponding audit table. This throws an exception while trying to determine the table name from the configuration with the new logic introduced in auditor 2.3.0, as the parent entity does not have any configuration:
Undefined array key "App\AbstractParentEntity"
https://github.com/DamienHarper/auditor/blob/19ff16a658e7bf268dbea7b88c08118da5caf1ae/src/Provider/Doctrine/Persistence/Schema/SchemaManager.php#L173
In versions before 2.3.0, the table name from the event was being used, which is independent of the configuration.
How to reproduce
Define an abstract parent entity and an audited child entity:
Configure auditing for the child entity:
Create the database schema using
Doctrine\ORM\Tools\SchemaTool::createSchema
for the parent entity to create anDoctrine\ORM\Tools\ToolEvents::postGenerateSchemaTable
event.Expected behavior
Creating the database schema for the abstract parent entity and its child entities does not throw an exception and creates the corresponding audit table schema.