Search code examples
phpcakephpscaffolding

CAKEPHP Admin with Scaffolding not working properly


I've enabled admin scaffolding, by uncommenting the line:

Configure::write('Routing.prefixes', array('admin')); 

inside core.php and adding the public $scaffold = 'admin'; into my AppController.

Everything seems to work but different controllers show the same page, only the Page Title is changing (the one beside the list table, see the image below).

I've 3 controllers: admin/Categories admin/Series admin/Products

Each of them show the Products list! So the Products admin is the only one that's working properly..

Any idea?

I just noticed that my Categories and Series controllers classes are empty, but I don't think it should be a problem:

class SeriesController extends SiteController {
}
class CategoriesController extends SiteController {
}

The image below shows the 3 admin pages, I've copied a screen for each of them and pasted them horizontally into the same png:

http://cakephp.1045679.n5.nabble.com/file/n5718223/Admin_Pages.png


Solution

  • Solved!

    The problem was in the AppController: it had this var:

    var $uses = array('Product', 'Category', 'Serie')
    

    In fact, adding also the User model caused all the admin pages to show only the User List, instead of the Products one:

    var $uses = array('User', 'Product', 'Category', 'Serie')
    

    So the problem has been solved by removing the $uses var.