Issues (104)

Controller/Adminhtml/Subseller/Delete.php (5 issues)

1
<?php
2
/**
3
 * Copyright © Getnet. All rights reserved.
4
 *
5
 * @author    Bruno Elisei <[email protected]>
6
 * See LICENSE for license details.
7
 */
8
9
namespace Getnet\SubSellerMagento\Controller\Adminhtml\Subseller;
10
11
use Magento\Framework\App\Action\HttpPostActionInterface;
12
use Magento\Framework\Controller\ResultFactory;
13
use Magento\Framework\Exception\NoSuchEntityException;
14
15
class Delete extends \Getnet\SubSellerMagento\Controller\Adminhtml\Subseller implements HttpPostActionInterface
16
{
17
    /**
18
     * Delete Rate and Data.
19
     *
20
     * @return \Magento\Backend\Model\View\Result\Redirect|void
21
     */
22
    public function execute()
23
    {
24
        if ($subSellerId = $this->getRequest()->getParam('subseller')) {
25
            /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
26
            $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
27
28
            try {
29
                $this->_subSellerRepository->deleteById($subSellerId);
30
31
                $this->messageManager->addSuccess(__('You deleted the sub seller.'));
0 ignored issues
show
Deprecated Code introduced by
The function Magento\Framework\Messag...Interface::addSuccess() has been deprecated: 100.1.0 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

31
                /** @scrutinizer ignore-deprecated */ $this->messageManager->addSuccess(__('You deleted the sub seller.'));

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
32
33
                return $resultRedirect->setPath('*/*/');
34
            } catch (NoSuchEntityException $e) {
35
                $this->messageManager->addError(
0 ignored issues
show
Deprecated Code introduced by
The function Magento\Framework\Messag...erInterface::addError() has been deprecated: 100.1.0 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

35
                /** @scrutinizer ignore-deprecated */ $this->messageManager->addError(

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
36
                    __('We can\'t delete this  sub seller because of an incorrect sub seller ID.')
37
                );
38
39
                return $resultRedirect->setPath('subseller/*/');
40
            } catch (\Magento\Framework\Exception\LocalizedException $e) {
41
                $this->messageManager->addError($e->getMessage());
0 ignored issues
show
Deprecated Code introduced by
The function Magento\Framework\Messag...erInterface::addError() has been deprecated: 100.1.0 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

41
                /** @scrutinizer ignore-deprecated */ $this->messageManager->addError($e->getMessage());

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
42
            } catch (\Exception $e) {
43
                $this->messageManager->addError(__('Something went wrong deleting this  sub seller.'));
0 ignored issues
show
Deprecated Code introduced by
The function Magento\Framework\Messag...erInterface::addError() has been deprecated: 100.1.0 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

43
                /** @scrutinizer ignore-deprecated */ $this->messageManager->addError(__('Something went wrong deleting this  sub seller.'));

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
44
            }
45
46
            if ($this->getRequest()->getServer('HTTP_REFERER')) {
0 ignored issues
show
The method getServer() does not exist on Magento\Framework\App\RequestInterface. It seems like you code against a sub-type of Magento\Framework\App\RequestInterface such as Magento\Framework\Webapi\Request or Magento\Framework\App\Request\Http. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

46
            if ($this->getRequest()->/** @scrutinizer ignore-call */ getServer('HTTP_REFERER')) {
Loading history...
47
                $resultRedirect->setRefererUrl();
48
            } else {
49
                $resultRedirect->setPath('*/*/');
50
            }
51
52
            return $resultRedirect;
53
        }
54
    }
55
}
56