Is it possible to define global conditions for Model ?
I have 2 Models: User and Student. In database both of them are using table u
you could use the afterFind callback to alter your finds in the model
public function afterFind($results, $primary = false) {
foreach ($results as $key => $val) {
if ($val['parent_id'] == NULL) { //no parent_id set then remove that part of the results
unset($results[$key]);
}
}
return $results;
}
reference: http://book.cakephp.org/2.0/en/models/callback-methods.html