if isset _POST idTagDisLike like ArticlesLikes model findAllByAttribut

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
if(isset($_POST['idTagDisLike']))
{
$like = ArticlesLikes::model()->findAllByAttributes(
array('id_article'=>$id, 'id_tag'=>$_POST['idTagDisLike'],'id_user' => Yii::app()->user->getId() )
);
if(!is_null($like))
$like->delete();
$this->redirect("#");
}