Last active
January 13, 2016 17:20
-
-
Save harikt/110dbf61cf089d3585f5 to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
use Cake\Event\EventManager; | |
$listener = new ModelInitialzieListener(); | |
EventManager::instance()->attach($listener); |
This file contains 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
<?php | |
use Cake\Event\EventListenerInterface; | |
class ModelInitialzieListener implements EventListenerInterface | |
{ | |
public function implementedEvents() | |
{ | |
return array( | |
'Model.initialize' => 'initializeEvent', | |
); | |
} | |
public function initializeEvent($event) | |
{ | |
$table = $event->subject(); | |
// do something here | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment