/** * @return \yii\db\ActiveQuery */ public function getComments() { return $this->hasMany(Comment::className(), ['post_id' => 'id']); }
/** * @inheritdoc */ public function behaviors() { return \yii\helpers\ArrayHelper::merge(parent::behaviors(), ['timestamp' => ['class' => \yii\behaviors\TimestampBehavior::className()], 'tree' => ['class' => NestedSetsBehavior::className(), 'treeAttribute' => 'tree']]); }