CakePHP 3 Tutorial 17: Adding Associated Records

Submitted by naidim on Tue, 10/25/2016 - 11:42

In the previous tutorial (CakePHP 3 Tutorial 16: Table Relationships) we set up associating tables and displaying associated data, but there's no point to displaying associated data if you can't add it first.

There are multiple ways to save associated data. We'll start with the easiest way first.

CakePHP 3 Tutorial 16: Table Relationships

Submitted by naidim on Fri, 10/21/2016 - 15:43

When working with CakePHP it is important to remember "Convention over Configuration." If you start from the bottom, or back end, the database, and work your way forward correctly, CakePHP will do much of legwork for you, saving tons of redundant and repetitive work. If you don't, there are almost always ways to make things work the hard way.

An example of this is the relationships between tables. If you name your database tables and fields following CakePHP convention, it becomes trivial to set up relationships between them.