![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/colissimo/module-shipping/Controller/Adminhtml/Price/ |
<?php /** * Colissimo Shipping Module * * @author Magentix * @copyright Copyright © 2018 Magentix. All rights reserved. * @license https://www.magentix.fr/en/licence.html Magentix Software Licence * @link https://colissimo.magentix.fr/ */ namespace Colissimo\Shipping\Controller\Adminhtml\Price; use Colissimo\Shipping\Api\PriceRepositoryInterface; use Magento\Backend\App\Action; use Exception; /** * Class Delete */ class Delete extends Action { /** * Authorization level of a basic admin session */ const ADMIN_RESOURCE = 'Colissimo_Shipping::shipping_price'; /** * @var PriceRepositoryInterface $priceRepository */ protected $priceRepository; /** * @param Action\Context $context * @param PriceRepositoryInterface $priceRepository */ public function __construct( Action\Context $context, PriceRepositoryInterface $priceRepository ) { $this->priceRepository = $priceRepository; parent::__construct($context); } /** * Save action * * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @return \Magento\Framework\Controller\ResultInterface */ public function execute() { $resultRedirect = $this->resultRedirectFactory->create(); try { $priceId = $this->getRequest()->getParam('price_id'); if ($priceId) { $this->priceRepository->deleteById($priceId); } $this->messageManager->addSuccessMessage(__('You deleted the price.')); } catch (Exception $e) { $this->messageManager->addExceptionMessage($e, __('Something went wrong while saving the price.')); } return $resultRedirect->setPath('*/*/'); } }