CakePHP v3


When defining associations, setDependent() is only reliable to 1 level of association, since it uses deleteAll(). setCascadeCallbacks() loads associated data and can therefore reach lower levels of association. This is neither well documented nor explained.

CakePHP v4



Default Indexes

DBAL will create an index for every foreign key in a table, even if they aren't really needed. These indexes will be randomly named, eg idx_a83421dae2f501f7. To maintain naming consistency, explicitly define an index for all foreign keys.

json_decode() Errors

(This isn't specific to DBAL, but the context it's mostly likely to be noticed in is editing schema.json.)

It can be pretty difficult to get an exact answer as to why json_decode() fails. json_last_error[_msg]() generally provides unhelpful error messages. The most likely causes for errors are:

  • An unmatched brace { }
  • A trailing comma (permitted in PHP but not JSON)
  • Single quotes instead of double quotes

Look at changes made since the last commit for any of the above.

  • No labels