I get the following errors:
Notice (8): Undefined property: ProductsController::$Category
**
Fatal error: Call to a member function find() on a non-object
**
in \shop\app\controllers\products_controller.php on line 7
Model:
class Category extends AppModel {
var $name = 'Category';
var $hasMany = array('Product');
}
Controller:
class CategoriesController extends AppController{
var $name = 'Categories';}
class ProductsController extends AppController{
var $name ='Products';
function lists(){
$categories = $this->Category->find( 'all',array('order'=>'Category.id ASC'));
}
i have two controller class 1. CategoriesController 2. ProductsController. when i used lists method in categories controller, it's work, but in products controller it give error?
Productmodel actually have aCategoryattribute?