-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
Many To Many audit relation fail with new entity in the relation. #522
Comments
Can I work on this? |
I myself I don't have time to work on this soon. I just fix downgrade the dependencies to the previous version. I don't see why you couldn't do a PR to fix it. But maybe maintainer could give the best way to fix it, mine was just a suggestion. |
We were forced to pin version |
Feel free to fix it. |
@VincentLanglet I'd be happy to! Since I'm not familiar with the internals of this bundle, if someone could at least provide some pointers as to what the fix could look like, that would be extremely helpful. |
This bundle was transferred to SonataProject (cf #343 (comment)) but we're not the original authors of this ; so we can't say we're way more familiar to such internals things. |
Hi same issue for me, the audit table used for ManyToMany relation won't be created but sonata try to feed the table, so an exception "table not found xxxx_audit does not exist" :/ |
If you say that 1.8.0 works fine for you it means that it's related to the PR #509 @nocive. A first step could be to create a test which fails to reproduce the issue. |
Environment
Sonata packages
show
Symfony packages
show
PHP version
Subject
Many To Many audit relation fail with new entity in the relation.
Steps to reproduce
Create EntityA with property many to many on EntityB.
Add one EntityB to the property of EntityA.
Flush when the full entity graph is still new.
Expected results
Everything should be persisted to the database.
Actual results
We get an error of constraint violation. Here is my example:
[Doctrine\DBAL\Exception\NotNullConstraintViolationException (1048)]
An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'role_id' cannot be null
Note
I am able to prevent this by saving the target entity of the many to many relation first.
Probably the post persist event is trigger event if the many to many relation is not saved yet.
Maybe all the logic of the LogRevisionsListener should be in the onFlush listener.
The text was updated successfully, but these errors were encountered: