yiisoft/yii — pull request #1508 by cebe (2012-10-01 11:24:47+00:00)
Title: fix #1381, ignore criteria and scope select on stat relation

fix #1381, ignore criteria and scope select on stat relation

**Do not merge now, will add unit tests later.**

select is different in stat relation context and can not be an array as
it specifies the statistical value to select.

So we have to ignore select that might have been defined by
defaultScope, scope or beforeFind criteria modification.

It is possible to set select via relation params and in relation definition but not via scope or beforeFind as the last two are not aware of the stat context.

```php
$post->commentCount(array('select' => 'RAND()'));
```
or:
```php
public function relations()
{
return array(
'commentCount => array(self::STAT, 'Comment', 'postId', 'select' => 'RAND()'),
);
}
```