You can set: var $uses=array('ModelName') in each of the controllers.
-- But just my opinion:
Don't name the table "objects" because your model name would be Object which is a class that already exists in CakePHP.
Second, why link multiple controllers to one model. Instead, link multiple models to one table. Then you would have EventsController which automatically links to Event model which uses table 'objects'. News automatically links to New Model which in turn uses 'objects' table.. etc
Then in the Event model for example you could have:
var $useTable='objects';
function beforeFind($queryData)
{
return Set::merge($queryData , array('conditions'=>array('Event.item_type'=>'event')));
}
I'm just brainstorming ... :) Just let me know what you think...
On Thu, Sep 1, 2011 at 7:51 AM, Heshanh <heshanh@gmail.com> wrote:
I have a table called 'objects' and each record has an item_type.
for example :
row 1:
id = 1
item_type = event
row 2:
id =2
item_type = news
row 3:
id =3
item_type = booking
I have a model for the table but is it possible to have multiple
controllers accessing this model,
I want to have an events controller that will handle all the events,
news controller that will handle all the news... and so on
is this possible for cakePhp?
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment