One time-saving feature it would be quite nice to see would be the ability to turn any find() into a findByAttributes() by adding another property to CDbCriteria. The way I see it working, the following two finds would return the same results:
$FiveOldestDavids = Person::model()->findAllByAttributes( array( 'Name' => 'David' ), array( 'order' => 'Age DESC', 'limit' => 5, ) ); $FiveOldestDavids = Person::model()->findAll( array( 'attributes' => array( 'Name' => 'David' ) 'order' => 'Age DESC', 'limit' => 5, ) );
The advantage for me is that this is more readable, IMHO. Sure, you could build the criteria first and pass the constructed criteria to the find(), but this often isn’t an option when you’re not doing a real find() function call (it’d be nice to do this in scopes and even relations).