modules/api/v2/controllers/ProductImageController.php
/**
     * Deletes an existing ProductImage 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 ProductImage 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 ProductImage 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 = ProductImage::findOne($id);
        if (empty($model) && !$model instanceof ProductImage) {
            throw new NotFoundHttpException('Product image doesn\'t exist.');
        }
        if (!empty($model->name) && file_exists(Yii::getAlias('@productImageRelativePath') . "/" . $model->name)) {
            unlink(Yii::getAlias('@productImageRelativePath') . "/" . $model->name);
        }
        if (!empty($model->name) && file_exists(Yii::getAlias('@productImageThumbRelativePath') . "/" . $model->name)) {
            unlink(Yii::getAlias('@productImageThumbRelativePath') . "/" . $model->name);
        }
        $model->delete();
    }
public function actionDelete ( $ id ) { $ model = ProductImage :: findOne ( $ id ) ; if ( empty ( $ model ) && ! $ model instanceof ProductImage ) { throw new NotFoundHttpException ( 'Product image doesn\'t exist.' ) ; } if ( ! empty ( $ model -> name ) && file_exists ( Yii :: getAlias ( '@productImageRelativePath' ) . " / " . $ model -> name ) ) { unlink ( Yii :: getAlias ( '@productImageRelativePath' ) . " / " . $ model -> name ) ; } if ( ! empty ( $ model -> name ) && file_exists ( Yii :: getAlias ( '@productImageThumbRelativePath' ) . " / " . $ model -> name ) ) { unlink ( Yii :: getAlias ( '@productImageThumbRelativePath' ) . " / " . $ model -> name ) ; } $ model -> delete ( ) ; }
Deletes an existing ProductImage model.
Deletes an existing ProductImage model .