Hey Guys,
I have a system with products and categories.
In the CategoriesController there is a method breadcrumb($id) that
makes use of the Category model via
$this->Category->read();
In my ProductsController i'd also like to have access to the the
breadcrumb($id) so I have used the code:
App::import('Controller', 'Categories');
$categories = new CategoriesController();
This works fine but the issue arises when I try to run:
$categories->breadcrumb($id);
I receive an error of: Fatal error: Call to undefined method
stdClass::read() . Which seems to be flagging because the Category
model is not defined?
I can work around it by creating an element or using requestAction or
even checking for the existence of the model inside the controller
with something like:
if (!empty($this->Category))
{
App::import('Model', 'Category');
}
But these all seem very hacky and id have to repeat the process for
every function I want to use. Is there an elegant way around this
problem?
Thanks for reading :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---