I have baked views for 3 different tables Mitarbeiters, Kosts, Inventars
now I want to join Mitarbeiters one to one to Kosts and Mitarbeiters one to many to Inventars
is it possible to manage this with a bake command and what are the necessary steps for that
thanks a lot
-
please use english names for your tables. See our conventions to learn more of when you should singular and when to use plural.
-
if you name your tables and foreign key columsn appropriatly, then cakephp will automatically create those associations for your.
In your example a 1 to many association would be table `staffmembers` with the usual `id` column and table `inventory_entries` with the `staff_member_id` column.
A 1:1 association can be defined by putting the foreign key on either one of your tables (you decide) AND adding a UNIQUE constraint on that foreign key
Also see Associations - Linking Tables Together | CakePHP