Thursday, July 31, 2014

Problem on CakePHP Plugin - Error “Controller could not be found”


I'm currently using CakePHP 2.5.2 I want to integrate a plugin to manage Users. I tested it in a first time as a single CakePHP Application (controllers in app/controller, models in app/model, views in app/view/Users): was ok.

I'm trying now to convert it as a plugin: I've created a folder UserManager in app/plugin.

When I try to go to the url of one of my controllers, I get the message Missing Controller. All plugin are loaded in Bootstrap.php (CakePlugin::loadAll();).

I tried to find similar problems vs solutions but no one was relevant with my problem (I tried some proposed solutions but root causes were different.

When I look at DebugKit in Include section, I can observe that my DebugKit plugin is loaded but not my other plugin...

Could some one suggest me a solution ? Thanks in advance.

(Please find bellow a description of the code)

I added controllers, models and views as follows (skeleton generated by Bake and checked: ok):

1) Models in app/plugin/model

UserManagerAppModel.php

<?php  App::uses('AppModel', 'Model');  class UserManagerAppModel extends AppModel {  }  ?>

User.php

<?php  App::uses('AuthComponent', 'Controller/Component');  class User extends UserManagerAppModel {    ...  }  ?>

2) Controllers in app/plugin/controller

UserManagerAppModel.php:

<?php  App::uses('AppController', 'Controller');  class UserManagerAppController extends AppController {  }  ?>

UserController.php:

<?php  class UsersController extends UserManagerAppController {      public $uses = array('UserManager.User');      public function beforeFilter() {          parent::beforeFilter();          $this->Auth->allow('*');       }      public function login() {                 }      ...  ?>  

3)Views in app/plugin/view/Users

Nothing special.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: