Skip to content

Commit

Permalink
Merge pull request noumo#33 from evgenmil/patch-1
Browse files Browse the repository at this point in the history
Update News.php
  • Loading branch information
noumo committed May 14, 2015
2 parents 451a11c + 9fe5372 commit b4e051d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/news/api/News.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function api_last($limit = 1)

public function api_get($id)
{
if(!($news = NewsModel::findOne(['news_id' => $id, 'status' => NewsModel::STATUS_ON]))){
if(!($news = NewsModel::find()->where(['or', 'news_id=:id_slug', 'slug=:id_slug'], [':id_slug' => $id])->andWhere(['and', 'status=:st'], [':st' => NewsModel::STATUS_ON])->one())){
return $this->notFound();
}

Expand Down Expand Up @@ -138,4 +138,4 @@ private function notFound()
return $this->createObject($this->errorText('WRONG NEWS_ID'));
}
}
}
}

0 comments on commit b4e051d

Please sign in to comment.