How to override models and controllers in a plugin in CakePHP?

How can I override the CakePHP plugin from within the application? I see that overriding the view is very easy ( http://book.cakephp.org/2.0/en/plugins.html#overriding-plugin-views-from-inside-your-application ), but how can I override the controller or model ?

+3


source to share


2 answers


No, you cannot override any plugin class files in your application, as you can view files. Just make a copy of the plugin and modify the required class files.



+2


source


You can override and extend the list of plugin modules and controllers. See the link below for a good example of this.

https://github.com/CakeDC/users#how-to-extend-the-plugin

It's basically a summary ... In your model, you need to declare it like this.



App::uses('UsersController', 'Users.Controller');

class AppUsersController extends UsersController {

}

+5


source







All Articles