thelia icon indicating copy to clipboard operation
thelia copied to clipboard

A language cannot be deleted if it is referenced by an order

Open roadster31 opened this issue 9 years ago • 5 comments

When trying to delete an language, the following error is displayed if this language is referenced in the order table.

Propel\Runtime\ActiveQuery\ModelCriteria::delete is unable to delete.

The exception cause is :

SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (thelia2.order, CONSTRAINTfk_order_lang_idFOREIGN KEY (lang_id) REFERENCESlang(id))

We have to remove this constraint (which, BTW, doesn't exists in the customer table).

roadster31 avatar Apr 23 '15 20:04 roadster31

We already talked about this. I think that the solution is to create an order_lang table to always keep all the data of every order.

lovenunu avatar Apr 24 '15 07:04 lovenunu

:+1:

roadster31 avatar Apr 24 '15 07:04 roadster31

Ohhh, I already posted an issue for that Oo #644 Let's close one of the two issues :)

lovenunu avatar May 28 '15 13:05 lovenunu

This issue is partially fixed by #1832 Language has now two flag active and visible to display it in back and front. So we're not obliged to delete it to hide it in the front.

bibich avatar Jan 07 '16 15:01 bibich

I dot not agree to close this issue. A Thelia admin should be able to completely delete a language. @lovenunu gave the proper solution to this problem.

roadster31 avatar Jan 07 '16 16:01 roadster31

Should implement a table order_lang, like #964

anoziere avatar Feb 09 '24 10:02 anoziere

Same issue as #1145, the order table should not have any foreign keys on a table that does not belong to the order.

lopes-vincent avatar Feb 23 '24 10:02 lopes-vincent