1.1.1 Breaks statistical (stat) count on a many to many relationship

Upgraded to 1.1.1 today. Almost there but now I have a real show stopper:

This is a gallery application with artwork. I have a many to many relationship between galleries and art: I use a join table called galXart. When displaying a list of galleries I had (previous to 1.1.1) a nice count of all art associated with a gallery by using this relationship:

'artCount'=>array(self::STAT, 'art' , 'galXart(galID, artID)')

When creating a list of the galleries I did this:

 public function getGalleries($type)


        $type = 'type =' . $type;

        $galleries = Galleries::model()->with('artCount')->findAll(array(


            'order'=>'weight ASC',

            'condition'    => $type,



        return $galleries;


It worked like a charm in pre 1.1.1. Now I get a white screen. No entries at all in the application log or the PHP log.

If I remove the offending

the galleries query works fine (no count though).

I’ve been tinkering but can’t seem to find an answer. As far as I know this should not have changed with upgrade, should it…?

This has been fixed in trunk for version 1.1.2. Meanwhile, you can comment out the line that causes the die().


Is there an issue with has many too?

The relation "voteCount" in active record class "Rating" is specified with an invalid foreign key. The columns in the key must match the primary keys of the table "rating".

return array(

			'votes' => array(self::HAS_MANY, 'Votes', 'rating_id'),

            'voteCount'=>array(self::STAT, 'Votes', 'rating_id'),


The has many does work but stat does not? ahhh i see it was because it had 2 primary keys :)