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

Can't create news when id_user different of id contact #15

Open
mickael77 opened this issue Dec 19, 2021 · 5 comments
Open

Can't create news when id_user different of id contact #15

mickael77 opened this issue Dec 19, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@mickael77
Copy link

Hi,

When I create a news, I have this error :
"Error - There was an error when trying to save the form"

I can't create news because my id contact is different of my user_id
my id_user : 1
my id_contact : 2

When I create news, changerId : 2
When news is updated to set routes, changerId : 1

Have you an idea ?

Thank you

Capture

@TheCadien
Copy link
Owner

I'll check that, Thanks for reporting ! :)

@TheCadien
Copy link
Owner

@mickael77 i've testet you bug and i'm sorry i cant reproduce.
Could you take me more Details ?

@TheCadien
Copy link
Owner

Okay found the Issue, its the ActivityEvent.

@TheCadien TheCadien added the bug Something isn't working label Mar 28, 2023
@JAF-avonehr
Copy link

Hi, I encountered the very same issue with foreign key constraint violation.

{"message":"Uncaught PHP Exception Doctrine\\DBAL\\Exception\\ForeignKeyConstraintViolationException: \"An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`foo_production`.`su_news`, CONSTRAINT `FK_9DD797ECE53CD0CE` FOREIGN KEY (`changer_id`) REFERENCES `co_contacts` (`id`) ON DELETE SET NULL)\" at /srv/web/foo-production/current/web/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php line 58","context":{"exception":{"class":"Doctrine\\DBAL\\Exception\\ForeignKeyConstraintViolationException","message":"An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`foo_production`.`su_news`, CONSTRAINT `FK_9DD797ECE53CD0CE` FOREIGN KEY (`changer_id`) REFERENCES `co_contacts` (`id`) ON DELETE SET NULL)","code":1452,"file":"/srv/web/foo-production/current/web/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:58","previous":{"class":"Doctrine\\DBAL\\Driver\\PDO\\Exception","message":"SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`foo_production`.`su_news`, CONSTRAINT `FK_9DD797ECE53CD0CE` FOREIGN KEY (`changer_id`) REFERENCES `co_contacts` (`id`) ON DELETE SET NULL)","code":1452,"file":"/srv/web/foo-production/current/web/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:30","previous":{"class":"PDOException","message":"SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`foo_production`.`su_news`, CONSTRAINT `FK_9DD797ECE53CD0CE` FOREIGN KEY (`changer_id`) REFERENCES `co_contacts` (`id`) ON DELETE SET NULL)","code":23000,"file":"/srv/web/foo-production/current/web/vendor/doctrine/dbal/src/Driver/PDO/Statement.php:101"}}}},"level":500,"level_name":"CRITICAL","channel":"request","datetime":"2023-12-14T13:37:57.771230+01:00","extra":{}}

What can I do to fix this?

@TheCadien
Copy link
Owner

The problem is unfortunately that I made a mistake when creating the bundle, which entity is used to link a user correctly.
This will be fixed in version 2.0 and there will be a BC.
Unfortunately there will be no fix for version 1.X.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants