Reputation: 984
I'm new to CakePHP. So far I managed to build up some views, controllers and models. Here is my problem:
I have two tables:
For each table I have a model, a view and a controller which is working fine. Now I want to make a index.php where I want to combine three elements:
Every of these elements is ready, but not the combination of these in one view. Do I have to make an extra controller which combines these 3 elements? Is a controller without a model possible or wise?
The two controllers are also associated with each other:
I think the solution is not so difficult, but I would know what the best-practice is.
Upvotes: 0
Views: 85
Reputation: 405
To follow conventions, your table names should be tea_types
and steep_logs
, the models for them should be TeaType
and SteepLog
, and the controllers should be TeaTypesController
and SteepLogsController
.
Without your schema, I can't tell you exactly how your model associations should be set by convention, but, logically I would think that TeaType hasMany SteepLog
and SteepLog belongsTo TeaType
. You can find out how to define your schema to fit the model association conventions from the blog tutorial or Cake book, that topic is too lengthy to summarize here.
Once your model associations are defined, you'll be able to find and manipulate both models from both controllers as needed.
Upvotes: 1