modules/api/v2/controllers/BrandController.php
/**
     * Deletes an existing Brand model.
     * If deletion is successful, the browser will be redirected to the 'index' page.
     * @param integer $id
     * @return mixed
     * @throws NotFoundHttpException if the model cannot be found
     */
Deletes an existing Brand model.
If deletion is successful, the browser will be redirected to the 'index' page.
@param integer $id
@return mixed
@throws NotFoundHttpException if the model cannot be found
Deletes an existing Brand model . If deletion is successful the browser will be redirected to the ' index ' page . @param integer $id @return mixed @throws NotFoundHttpException if the model cannot be found
public function actionDelete($id)
    {
        $model = Brand::findOne($id);
        if (!$model instanceof Brand) {
            throw new NotFoundHttpException('Brand doesn\'t exist.');
        }
        $uploadDirPath = Yii::getAlias('@brandImageRelativePath');
        $uploadThumbDirPath = Yii::getAlias('@brandImageThumbRelativePath');
        if (!empty($model->image) && file_exists($uploadDirPath . "/" . $model->image)) {
            unlink($uploadDirPath . "/" . $model->image);
        }
        if (!empty($model->image) && file_exists($uploadThumbDirPath . "/" . $model->image)) {
            unlink($uploadThumbDirPath . "/" . $model->image);
        }
        $model->delete();
    }
public function actionDelete ( $ id ) { $ model = Brand :: findOne ( $ id ) ; if ( ! $ model instanceof Brand ) { throw new NotFoundHttpException ( 'Brand doesn\'t exist.' ) ; } $ uploadDirPath = Yii :: getAlias ( '@brandImageRelativePath' ) ; $ uploadThumbDirPath = Yii :: getAlias ( '@brandImageThumbRelativePath' ) ; if ( ! empty ( $ model -> image ) && file_exists ( $ uploadDirPath . " / " . $ model -> image ) ) { unlink ( $ uploadDirPath . " / " . $ model -> image ) ; } if ( ! empty ( $ model -> image ) && file_exists ( $ uploadThumbDirPath . " / " . $ model -> image ) ) { unlink ( $ uploadThumbDirPath . " / " . $ model -> image ) ; } $ model -> delete ( ) ; }
Deletes an existing Brand model.
Deletes an existing Brand model .