public function actionDeleteImage(int $id, string $imageType)
    {
        $this->trigger(self::EVENT_BEFORE_EDIT_CATEGORY, new CategoryEvent());

        $category = Category::findOne($id);

        if (\Yii::$app->shop_imagable->delete('shop-category/' . $imageType, $category->$imageType)) {
            $category->$imageType = null;
            $category->save();
            Yii::$app->getSession()->setFlash('success', 'The image has been successfully deleted.');
            $this->trigger(self::EVENT_AFTER_EDIT_CATEGORY, new CategoryEvent(['id' => $id]));
        } else Yii::$app->getSession()->setFlash('error', 'Error deleting image.');

        return $this->redirect(\Yii::$app->request->referrer);
    }
public function actionDeleteImage(int $id, string $imageType)
    {
        $this->trigger(self::EVENT_BEFORE_EDIT_CATEGORY, new CategoryEvent());

        $category = Category::findOne($id);

        if (\Yii::$app->shop_imagable->delete('shop-category/' . $imageType, $category->$imageType)) {
            $category->$imageType = null;
            $category->save();
            Yii::$app->getSession()->setFlash('success', 'The image has been successfully deleted.');
            $this->trigger(self::EVENT_AFTER_EDIT_CATEGORY, new CategoryEvent(['id' => $id]));
        } else Yii::$app->getSession()->setFlash('error', 'Error deleting image.');

        return $this->redirect(\Yii::$app->request->referrer);
    }
public function actionDeleteImage ( int $ id , string $ imageType ) { $ this -> trigger ( self :: EVENT_BEFORE_EDIT_CATEGORY , new CategoryEvent ( ) ) ; $ category = Category :: findOne ( $ id ) ; if ( \ Yii :: $ app -> shop_imagable -> delete ( 'shop-category/' . $ imageType , $ category -> $ imageType ) ) { $ category -> $ imageType = null ; $ category -> save ( ) ; Yii :: $ app -> getSession ( ) -> setFlash ( 'success' , 'The image has been successfully deleted.' ) ; $ this -> trigger ( self :: EVENT_AFTER_EDIT_CATEGORY , new CategoryEvent ( [ 'id' => $ id ] ) ) ; } else Yii :: $ app -> getSession ( ) -> setFlash ( 'error' , 'Error deleting image.' ) ; return $ this -> redirect ( \ Yii :: $ app -> request -> referrer ) ; }
Deletes one image from category

@param integer $id
@param string $imageType
@return mixed
@throws ForbiddenHttpException
Deletes one image from category