TheCadien / SuluNewsBundle

Simple News Bundle for Sulu 2 CMS
MIT License
14 stars 12 forks source link

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

Open mickael77 opened 2 years ago

mickael77 commented 2 years ago

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 commented 2 years ago

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

TheCadien commented 2 years ago

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

TheCadien commented 2 years ago

Okay found the Issue, its the ActivityEvent.

JAF-avonehr commented 11 months ago

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 commented 11 months ago

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.