public static function removeTags($tags, $classify_type) { if (empty($tags)) { return; } $count = Tag::find()->where(['name' => $tags, 'classify_type' => $classify_type])->one(); if (isset($count) && !empty($count)) { $count->frequency -= 1; $count->save(); Tag::deleteAll('frequency<=0'); } //$criteria=new CDbCriteria; //$criteria->addInCondition('name',$tags); //$this->updateCounters(array('frequency'=>-1),$criteria); //$this->deleteAll('frequency<=0'); }