forrest lyman Fri Jan 28 01:30:36 -0500 2011

Subject: callback for fetch operations?

is there any built in way to a condition to all queries for a model?

i have a base user model and a separate model for each user role. i want to automatically add the role=? condition to every query.

for example

class Student extends User {
static $role = 'student';
}

Student::find('all') would equal SELECT * FROM users WHERE role='student';

i figure this is possible by overloading the find() method, but that seems a little hacky.


Kien La Fri Feb 04 17:05:46 -0500 2011

No, nothing like this is supported at the moment.

(1-1/1)