-
Notifications
You must be signed in to change notification settings - Fork 234
Open
Labels
Description
This bug was introduced in e73ffe6 (Issue #744)
Apparently, now that Model has both a __call() and __callStatic() method, when I attempt to invoke a finder from within an instance method of the model itself using the "syntactic magic" from Model's __callStatic(), it will go through the __call() method instead.
Example:
class Users extends \lithium\data\Model {
public function getNext($entity, $token = null) {
$conditions = [...];
return static::first(compact('conditions'));
}
}
It invokes Model::__call() instead of Model::__callStatic() and I get the exception Unhandled method call 'first'.
If I define it this way, it'll work... but it's not ideal, and the magic method used to work just fine.
class Users extends \lithium\data\Model {
public function getNext($entity, $token = null) {
$conditions = [...];
return static::find('first',compact('conditions'));
}
}
Related stackoverflow threads: