Created
June 17, 2011 13:28
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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