modules/admin/controllers/SizeController.php
/**
     * Deletes an existing Sizes 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 Sizes 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 Sizes 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 = $this->findModel($id);
        $modelsProductSize = $model->productSizes;
        if (!empty($model) && !empty($modelsProductSize) && count($modelsProductSize) > 0) {
            Yii::$app->session->setFlash(Growl::TYPE_INFO, count($modelsProductSize) . " Product(s) are using this size, So you can not delete this size!");
        } elseif (!empty($model) && empty($modelsProductSize) && count($modelsProductSize) <= 0) {
            $model->delete();
            Yii::$app->session->setFlash(Growl::TYPE_SUCCESS, "Size deleted successfully.");
        } else {
            Yii::$app->session->setFlash(Growl::TYPE_DANGER, "Error while deleted Size.");
        }
        return $this->redirect(['index']);
    }
public function actionDelete ( $ id ) { $ model = $ this -> findModel ( $ id ) ; $ modelsProductSize = $ model -> productSizes ; if ( ! empty ( $ model ) && ! empty ( $ modelsProductSize ) && count ( $ modelsProductSize ) > 0 ) { Yii :: $ app -> session -> setFlash ( Growl :: TYPE_INFO , count ( $ modelsProductSize ) . "  Product(s) are using this size, So you can not delete this size! " ) ; } elseif ( ! empty ( $ model ) && empty ( $ modelsProductSize ) && count ( $ modelsProductSize ) <= 0 ) { $ model -> delete ( ) ; Yii :: $ app -> session -> setFlash ( Growl :: TYPE_SUCCESS , " Size deleted successfully. " ) ; } else { Yii :: $ app -> session -> setFlash ( Growl :: TYPE_DANGER , " Error while deleted Size. " ) ; } return $ this -> redirect ( [ 'index' ] ) ; }
Deletes an existing Sizes model.
Deletes an existing Sizes model .