Skip to content

Instantly share code, notes, and snippets.

@bayleedev
Created June 26, 2013 19:49
Show Gist options
  • Save bayleedev/5870986 to your computer and use it in GitHub Desktop.
Save bayleedev/5870986 to your computer and use it in GitHub Desktop.
<?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;
});
@agborkowski
Copy link

L10 i tried put echo 'test'; exit; and still nothing ;/ #L8 isset true so applyFIlter still dont want to execute

@bayleedev
Copy link
Author

@agborkowski

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.

@agborkowski
Copy link

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