Open izemize opened 8 years ago
Hy
When you use "articles/view/10-elethelyzet-ami-szemuvegeskent-ismeros-lehet" or "articles/view/10" return wrong article. It's because you use OR operator in where clause with string and integer. Maybe fix this.
private function findItem($id_slug) { if( is_int($id_slug) ) { $article = Item::find()->where('item_id = :id_slug',[':id_slug'=>$id_slug])->status(Item::STATUS_ON)->one(); }else { $article = Item::find()->where('slug=:id_slug',[':id_slug'=>$id_slug])->status(Item::STATUS_ON)->one(); } //$article = Item::find()->where(['slug'=>$id_slug])->status(Item::STATUS_ON)->one(); if($article) { $article->updateCounters(['views' => 1]); return new ArticleObject($article); } else { return null; } }
Hy
When you use "articles/view/10-elethelyzet-ami-szemuvegeskent-ismeros-lehet" or "articles/view/10" return wrong article. It's because you use OR operator in where clause with string and integer. Maybe fix this.