I have got a model “File”, which is nested, having it’s parent in $file->parent.
The Model “File” has a beforeFind(&$evt), modifying the CDbCriteria of it’s owner.
I have a code like:
while($file->parent_id !== NULL && $file = $file->parent);
The beforeFind()-method of the Behavior is evidently called twice on the same CDbCriteria (triggered by this line). This leads to an error because it joins some tables, as the identifiers become ambiguous.
I’m not sure if this is a bug, on the other hand I don’T get why the CDbCriteria remains the same - $file is entirely overwritten by its parent.
EDIt: Github Criteria Bug does not apply, as it does not work even if I use the newest version from github (the bug is marked as fixed).