Created
June 26, 2013 19:49
-
-
Save bayleedev/5870986 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 lithium\core\Libraries; | |
Libraries::applyFilter('instance', function($self, $params, $chain) { | |
$data = $chain->next($self, $params, $chain); | |
if (isset($params['options']['model'])) { | |
$data->applyFilter('save', function() { | |
// .... | |
}); | |
} | |
return $data; | |
}); |
See if #L9 is even being called. Push it down and put an echo there. If it's never being called, and you know models are being created, I may be detecting them wrong.
In my example I see if a certain parameter exists, which isn't a great detection method anyways. Do some print_r
's to see what all goes through there and what you can better filter.
detection working gr8 isset(params..) is true but apply filter save wont called ;// anyway i'll debug it
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
L10 i tried put echo 'test'; exit; and still nothing ;/ #L8 isset true so applyFIlter still dont want to execute