Is it possible to define global conditions for Model ?
I have 2 Models: User
and Student
. In database both of them are using table users
but each student has set parent_id
to its owner (which is set in the same table) while each user has parent_id
set to Null
.
When I use for example
$this->find('all');
in Student
Model I want to force Cake to return only those records from database table users
where parent_id != Null
.
So the question is - can I define somehow global conditions in the Model? Something like that:
public $conditions = array('Student.parent_id !=' => Null);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…