Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix audit revision query for enum column mapping #534

Merged

Conversation

X-Coder264
Copy link
Contributor

@X-Coder264 X-Coder264 commented Feb 3, 2023

Subject

I am targeting this branch, because it's a bug fix.

After doctrine/orm#10088 we get an enum object back in the DEL revision saveRevisionEntityData code path instead of an integer or string value which then blows up on the $conn->executeStatement() call with the following exception:

Error: Object of class Sonata\EntityAuditBundle\Tests\Fixtures\Issue\Status could not be converted to string

vendor/doctrine/dbal/src/Driver/PDO/Statement.php:56

Changelog

### Fixed
- Audit query for Doctrine ORM >= 2.14.1 for entities with enumType column mapping

Copy link
Member

@VincentLanglet VincentLanglet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix, do you have time to take a look at the ci errors ?
You'll need to

  • Solve some linters errors
  • Solve some "possiblyNull" static analysis error by adding static::assertNotNull($foo).
  • Skip the test for PHP version which doesn't support ENUM

composer.json Outdated Show resolved Hide resolved
@X-Coder264
Copy link
Contributor Author

Even though the test I've added is marked as requiring PHP 8.1 to run, the PHP 7.4 and PHP 8.0 pipelines are still failing as the entity with the enum mapping class metadata is still being registered (so it blows up in Doctrine/ORM/Mapping/ClassMetadataFactory). Does anybody have a suggestion how we can solve this?

@VincentLanglet
Copy link
Member

Even though the test I've added is marked as requiring PHP 8.1 to run, the PHP 7.4 and PHP 8.0 pipelines are still failing as the entity with the enum mapping class metadata is still being registered (so it blows up in Doctrine/ORM/Mapping/ClassMetadataFactory). Does anybody have a suggestion how we can solve this?

Filtering here maybe https://github.com/sonata-project/EntityAuditBundle/blob/1.x/tests/BaseTest.php#L98-L102

@X-Coder264
Copy link
Contributor Author

Even though the test I've added is marked as requiring PHP 8.1 to run, the PHP 7.4 and PHP 8.0 pipelines are still failing as the entity with the enum mapping class metadata is still being registered (so it blows up in Doctrine/ORM/Mapping/ClassMetadataFactory). Does anybody have a suggestion how we can solve this?

Filtering here maybe https://github.com/sonata-project/EntityAuditBundle/blob/1.x/tests/BaseTest.php#L98-L102

@VincentLanglet Thanks - all CI pipelines have now passed 🎉

@VincentLanglet VincentLanglet merged commit a4a9470 into sonata-project:1.x Feb 6, 2023
@VincentLanglet
Copy link
Member

Thanks

@X-Coder264 X-Coder264 deleted the fix-logging-for-enum-mapping branch February 6, 2023 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants