CActiveDataProvider find by function

Hello everyone,

I want to create a CActiveDataProvider Object of those Record Objects returning a specific value.

The background is, I want to get those auctions, that are currently running. Only starting- and ending-time are stored in the db, the "status code" is determined by a function.

My pseudo yii code:


                $dpRunningAuctions=new CActiveDataProvider('Auction',array(

                    'criteria'=>array(

                        'condition'=>Auction::model()->getStatusCode == 1; //this is obviously invalid, but is there a solution for something like that?

                        

                    )));

Can’t you just select all auctions where the ending time is after the current time?

The problem is, that I want to select those Project-Objects wich only contain Item-Objects having an Auction-Object wich has specific values.

Of course one could find those by checking the timestamps in the query itself, but for this check there is the function "Item->getStatusCode()". This function does not only check the timestamp but different status-related values. I am using this function frequently and it would be suboptimal if I had to do this workaround.

How do I get those Project-Objects containing only those Item-Objects returning a specific value by a function?

Is this possible or not?