public function actionTest() { $data = []; if (Yii::$app->request->post()) { $data = Yii::$app->request->post(); if (isset($data['url'])) { $parser = new NewsParserComponent(ParserQueue::findOne(1)); $data['parserResult'] = $parser->parse(PageLoaderComponent::load($data['url']), $data['url'], Sources::findOne($data['Source'])); } } return $this->render('test', $data); }
/** * Finds the Sources model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * * @param integer $id * * @return Sources the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Sources::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }