3
votes

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

2

2 Answers

5
votes

You can override and extend plugin views modeld and controllers. There is a good example of doing this in the below link.

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

Basically this is the summary... In your model you need to declare it like so.

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

class AppUsersController extends UsersController {

}

2
votes

No you cannot override any plugin class files in your app like you can do for view files. Just make a copy of the plugin and modify required class files.