Skip to content

Instantly share code, notes, and snippets.

@brandoncordell
Created June 17, 2011 13:28
Show Gist options
  • Save brandoncordell/1031417 to your computer and use it in GitHub Desktop.
Save brandoncordell/1031417 to your computer and use it in GitHub Desktop.
Extending components in CakePHP without having to change all the calls to the original component
// controllers/components/custom_acl.php
App::import('Component', 'Acl');
class CustomAclComponent extends AclComponent {
public function example() {
// override the function
}
}
Then in your app_controller
// app_controller.php
class AppController extends Controller {
public $components = array('CustomAcl');
public function constructClasses() {
parent::constructClasses();
$this->Acl = $this->CustomAcl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment