I upgraded Yii to 1.1.13 and went through the UPGRADE file, as always. The doc says:
Since version 1.1.13 changes to query criteria made in beforeFind() now also apply to the query when model is loaded in a relational context.
The main problem here is that you can not use the `t`-alias for your table anymore, you have to change your code to
use the table alias currently in use as this is different in relational context.
You can get that alias by calling `$this->getTableAlias();` in your active record class
or `$this->owner->getTableAlias()` in behavior context.
$criteria->condition = 't.myfield = 1';
You need to change that to:
$alias = $this->owner->getTableAlias();
$criteria->condition = $alias.'.myfield = 1';
Okay, I expected my code to fail where I had used "t." but it didn't. For example the following snippet works as before:
$fuelings = new CActiveDataProvider('Fuelings', array( 'criteria' => array( 'condition' => 't.VehicleID=' . $this->VehicleID, 'with' => array('vehicle') ));
So, when exactly it's does the "t." alias fail and should be replaced?