Re: Define query condition in model

2009-02-05 Thread Amit Badkas
I forgot to add one line before returning true, and that is $queryData['conditions'] = $conditions; 2009/2/5, Günther Theilen thei...@eqi.de: OK, thanks. But I thought maybe there was a way to do something like var $conditions = array('active' = 1); in the model, as I can to with $order or

Define query condition in model

2009-02-04 Thread Günther Theilen
Hi! Is there as way to define default conditions in the model? Let's say I have a model with a field active which can be 0 or 1. In most queries I need the condition active = 1 but sometimes I need the condition active in (0,1). Is there a way to define active = 1 as the default condition for

Re: Define query condition in model

2009-02-04 Thread Amit Badkas
Following code snippet may help you function beforeFind($queryData) { $conditions = $queryData['conditions']; if (!is_array($conditions)) { if (!$conditions) { $conditions = array(); } else { $conditions = array($conditions); } }

Re: Define query condition in model

2009-02-04 Thread Günther Theilen
OK, thanks. But I thought maybe there was a way to do something like var $conditions = array('active' = 1); in the model, as I can to with $order or $displayField. But that doesn't seem to work. Amit Badkas wrote: Following code snippet may help you function beforeFind($queryData) {