1
votes

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.

2

2 Answers

0
votes

I think it is an issue with your path names: They have to include the plugin name. Plus the folder names have to start with a capital letter by convention. For example, UserManagerAppModel has to be in the following file: app/Plugin/UserManager/Model/UserManagerAppModel.php.

See also http://book.cakephp.org/2.0/en/plugins.html#creating-your-own-plugins

0
votes

Since I believe has included AuthComponent settings in your AppController loginAction note the call and check the name of your plugin. In my case the plugin name is Barracuda, the error does not occur stopped until the call was made ​​for barracuda, with the first letter in lower case.

'loginAction' => array(
    'controller' => 'users',
    'action' => 'login',
    'plugin' => 'Barracuda'
),

for

'loginAction' => array(
    'controller' => 'users',
    'action' => 'login',
    'plugin' => 'barracuda'
),