/** * @param null $type * @return \yii\db\ActiveQuery */ public function getComments($type = null) { $query = Comment::find()->andWhere(['objectClass' => str_replace('\\', '_', get_class($this->owner)), 'objectPk' => $this->owner->id]); if ($type) { $query->andWhere(['type' => $type]); } return $query; }
public function down() { $this->dropTable(\dmuratov\comment\models\Comment::tableName()); }