i have 2 relations
return array(
'commentCount'=>array(self::STAT, 'Comment', 'postId'),
'comments'=>array(self::HAS_MANY, 'Comment', 'postId',
'limit'=>'10'
),
);
and when i’m getting comments everything is cool,
but when trying with commentCount it produces following error
yii version /1.0.9
PHP Error
Description
Undefined variable: parent
Source File
C:\wamp\framework\db\ar\CActiveFinder.php(1297)
01285: private function queryOneMany()
01286: {
01287: $relation=$this->relation;
01288: $model=CActiveRecord::model($relation->className);
01289: $builder=$model->getCommandBuilder();
01290: $schema=$builder->getSchema();
01291: $table=$model->getTableSchema();
01292: $pkTable=$this->_parent->model->getTableSchema();
01293:
01294: $fks=preg_split('/[\s,]+/',$relation->foreignKey,-1,PREG_SPLIT_NO_EMPTY);
01295: if(count($fks)!==count($pkTable->primaryKey))
01296: throw new CDbException(Yii::t('yii','The relation "{relation}" in active record class "{class}" is specified with an invalid foreign key. The columns in the key must match the primary keys of the table "{table}".',
01297: array('{class}'=>get_class($parent->model), '{relation}'=>$relation->name, '{table}'=>$pkTable->name)));
01298:
01299: // set up mapping between fk and pk columns
01300: $map=array(); // pk=>fk
01301: foreach($fks as $i=>$fk)
01302: {
01303: if(!isset($table->columns[$fk]))
01304: throw new CDbException(Yii::t('yii','The relation "{relation}" in active record class "{class}" is specified with an invalid foreign key "{key}". There is no such column in the table "{table}".',
01305: array('{class}'=>get_class($parent->model), '{relation}'=>$relation->name, '{key}'=>$fk, '{table}'=>$table->name)));
01306:
01307: if(isset($table->foreignKeys[$fk]))
01308: {
01309: list($tableName,$pk)=$table->foreignKeys[$fk];