I have a lot of queries, that must be executed in every controller's
every action. So I think the best thing to automate it is placing
these queries in one component.
The code looks like this:
class MenuComponent extends Object
{
var $categories = true;
var $controller = true;
function startup(&$controller)
{
$controller->Categories->findAll();
$controller->SubCategories->findAll();
... //do all other database stuff
}
}
And in a Controller simply write this: var $components = array('Menu')
instead of all these queries in every action. But the cakephp's manual
says, that it is not a good idea to access model from components. So
what should I do?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---