cakephp icon indicating copy to clipboard operation
cakephp copied to clipboard

Adding ORM rules with the same name overrides previous one without warning

Open nicosp opened this issue 1 year ago • 3 comments

Description

We have a lot of ORM rules with duplicate names which is not ideal but it used to work until 4.5. On upgrade to 5.0 rules with the same name get replaced and we get strange behavior with rules not being triggered. The ORM should give an indication that a rule was overriden with an exception to avoid hard to detect bugs.

CakePHP Version

5.0

PHP Version

8.2

nicosp avatar Apr 16 '24 07:04 nicosp

This issue is stale because it has been open for 120 days with no activity. Remove the stale label or comment or this will be closed in 15 days

github-actions[bot] avatar Aug 15 '24 00:08 github-actions[bot]

I can help with this but I don't want to start working unless there is an agreement. My preference is to simply throw an exception for duplicate names. IMO it's preferable to have easily detectable failures rather than subtle business logic failures.

nicosp avatar Aug 21 '24 14:08 nicosp

Throwing an exception sounds reasonable, you can make a PR targeting the 5.next branch.

ADmad avatar Aug 21 '24 14:08 ADmad