In the previous two tutorials we discussed adding associated records. But what if you want to select a record from an associated table where there are thousands of records? Autocomplete can help with this issue, but it requires a combination of parts to work.
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.
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.