获取父母有一些标准的对象-Yii


Get Objects which their parents have some criteria - Yii

我有一个对象Author、一个对象Post和一个对象CommentCommentBELONGS_TOPostPostBELONGS_TOAuthor

我想获得帖子在'01-02-2015'之后创建的所有评论,并且作者的生日01-01-1980之后。

我如何制定这些规则的条件/标准?

感谢

class Comment extends CActiveRecord {
   public function search(){
      $criteria = new CDbCriteria;
      $criteria->together = true;
      $criteria->with = array(
          'post' => array(
              'condition' => "created>='2015-02-01'",
              'joinType' => "INNER JOIN",
              'with' => array(
                  'author' => array(
                      'condition' => "birthday>='1980-01-01'",
                      'joinType' => "INNER JOIN",
                  )
              )
          )
      );
      return new CActiveDataProvider($this, array(
          'criteria' => $criteria
      ));
   }
}