/** * Delete channel */ public function actionDelete($id) { $channelId = new \MongoId($id); $articleCount = Article::countByChannel($channelId); if ($articleCount > 0) { return $articleCount; } if (!ArticleChannel::deleteAll(['_id' => $channelId])) { throw new ServerErrorHttpException("failed to delete article channel for unknown reason"); } Yii::$app->getResponse()->setStatusCode(204); }