Cstatrelation With Complex Foreign Key

I have this sort of situation:




create table post(

    postid INT NOT NULL PRIMARY KEY

   ,parentpostid INT REFERENCES post(postid)

)

create table post_property(

    propertyid INT NOT NULL PRIMARY KEY

   ,postid INT NOT NULL REFERENCES post(postid)

   ,key VARCHAR(128) NOT NULL

   ,value TEXT

)



I want to do this in my Model’s relations() array:




'overallChildCount' => array(

    self::STAT

   ,'Post'

   ,array('parentpostid','postid')

)

,'publishedChildCount' => array(

    self::STAT

   ,'Post'

   ,array('parentpostid','postid')

   ,'join' => 'INNER JOIN '.PostProperty::Model()->tableName().' AS pp USING(postid)'

   ,'condition' => 'pp.key = \'status\' AND pp.value = \'published\''

)



i.e., what I’m trying to do in publishedChildCount is to get the count of children of a post with a status of published. When I do:




$post = Post::Model()->findByPk(....);

$post->getRelated('publishedChildCount');



I get:




preg_match() expects parameter 2 to be string, array given (.... framework/db/ar/CActiveFinder.php:1363)



The overallChildCount relation gives me the same result when I call getRelated().

It appears that for CManyManyRelation types, it deals with foreignKeys that are arrays explicitly, but it doesn’t do this for CStatRelation types. Am I missing something here?

Thanks - Matt