UnionOfRAD/lithium — pull request #679 by jails (2012-11-14 13:11:57+00:00)
Title: Implements an ::_init() method for models

1 - If filters are applied outside a model A, and B extends A, filters won't get executed for B.
2 - Applying filter in `Model::__init()` using `static::applyFilter()` will make the lazy configuration with `Model::config()` useless. Moreover a Model::reset() won't reload the filters since `Model::__init()` is called once on class autoloading.

With this PR Model::_init() can be used as all `::init()` methods.

Use case:
{{{
class MyModel extends \lithium\data\Model {

public function _init() {
parent::_init();
static::applyFilter('save', function($self, $params, $chain) {
$response = $chain->next($self, $params, $chain);
return $response;
});
}
}
}}}