public function actionRemoveFile($fileId, $productId, $languageId)
    {
        if (\Yii::$app->user->can('updateProduct', ['productOwner' => Product::findOne($productId)->owner])) {
            ProductFile::deleteAll(['id' => $fileId]);
            $this->trigger(self::EVENT_AFTER_EDIT_PRODUCT, new ProductEvent([
                'id' => $productId
            ]));
            return $this->actionAddFile($productId, $languageId);
        } else throw new ForbiddenHttpException(\Yii::t('shop', 'You have not permission to do this action.'));
    }
public function actionRemoveFile($fileId, $productId, $languageId)
    {
        if (\Yii::$app->user->can('updateProduct', ['productOwner' => Product::findOne($productId)->owner])) {
            ProductFile::deleteAll(['id' => $fileId]);
            $this->trigger(self::EVENT_AFTER_EDIT_PRODUCT, new ProductEvent([
                'id' => $productId
            ]));
            return $this->actionAddFile($productId, $languageId);
        } else throw new ForbiddenHttpException(\Yii::t('shop', 'You have not permission to do this action.'));
    }
public function actionRemoveFile ( $ fileId , $ productId , $ languageId ) { if ( \ Yii :: $ app -> user -> can ( 'updateProduct' , [ 'productOwner' => Product :: findOne ( $ productId ) -> owner ] ) ) { ProductFile :: deleteAll ( [ 'id' => $ fileId ] ) ; $ this -> trigger ( self :: EVENT_AFTER_EDIT_PRODUCT , new ProductEvent ( [ 'id' => $ productId ] ) ) ; return $ this -> actionAddFile ( $ productId , $ languageId ) ; } else throw new ForbiddenHttpException ( \ Yii :: t ( 'shop' , 'You have not permission to do this action.' ) ) ; }
Users which have 'updateOwnProduct' permission can delete file only from Product models that have been created by their.
Users which have 'updateProduct' permission can delete file from all Product models.

@param integer $fileId
@param integer $productId
@param integer $languageId
@return mixed
@throws ForbiddenHttpException
Users which have updateOwnProduct permission can delete file only from Product models that have been created by their . Users which have updateProduct permission can delete file from all Product models .