Accessing and manipulating models inside components is not "evil," but
nor is it really necessary in your case.
In general, component logic is controller logic that's reuseable enough
to be extracted out into it's own entitiy, and for what you're trying
to do, a component is more trouble than it's worth. All you really
need is this:
class AppController extends Controller {
var $uses = array('Category');
var $helpers = array('Html', 'Javascript');
function beforeFilter ( ) {
$this->set('categories', $this->Category->findAll(null, null,
'position'));
}
}
And that covers the logic for all your controllers. You don't even
need to repetitively reference the helpers or the model.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---