php - Multiple controllers with a single model -


This is what is trying to do

Ive used several different types of items The table containing the data is Ive for example:

  line1: item_type = event line 2: item_type = news line 3: item_type = booking   

I want to write a controller 'event_controller' and use the 'object' model with it and only want to work with item_type of the event. Use another controller (news_controller) and the same model for the news.

How do I do it on the cakepp?

I am coming into the cake from codeigniter and CI. Can we do any model we can load in any controller, I do something similar to cake?

I would like to suggest you not to do the $ Uses statement Instead, you can use relationships of such models like $ this-> Model- & gt; M0del1- & gt; .... & gt; SomeFunc (); If the relationship exists.

If the relationship between the model does not exist then just use $ this-> loadModel ('ModelName'); Wherever you need it in a specific function

If you use var $ = array ('object'); It becomes global for the controller and it will load that model for all the functions of the controller whether you need it or not it will affect your performance.

If you use $ this-LoadModel ('ModelName'); In a particular function it will not load in all functions only in that function

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -