Yii Framework Forum: Relations Stat Can Add Condition ? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Relations Stat Can Add Condition ? Rate Topic: -----

#1 User is offline   Dũng Ninh Bình 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 27-July 12

Posted 26 October 2013 - 11:03 PM

Hi

Follow this tutorial statistical-query

class Post extends CActiveRecord
{
    public function relations()
    {
        return array(
            'commentCount'=>array(self::STAT, 'Comment', 'post_id'),
            'categoryCount'=>array(
                self::STAT, 'Category', 'post_category(post_id, category_id)'
            ),
        );
    }
}


Assuming table Comment have column created_date

In some case i want statistic some Comment have created_date from date to date.
So in my Criteria:
$criteria->addBetweenCondition('commentCount.created_date',$date_from,$date_to);

but i get this error 1054 Unknown column commentCount.created_date.

Can i add condition with relation STAT like relation HAS_MANY. Thanks
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users