Issues (104)

Controller/Adminhtml/Subseller/Edit.php (3 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 Getnet\SubSellerMagento\Controller\RegistryConstants;
12
use Magento\Framework\Controller\ResultFactory;
13
use Magento\Framework\Exception\NoSuchEntityException;
14
15
class Edit extends \Getnet\SubSellerMagento\Controller\Adminhtml\Subseller
16
{
17
    /**
18
     * Show Edit Form.
19
     *
20
     * @return \Magento\Backend\Model\View\Result\Page|\Magento\Backend\Model\View\Result\Redirect
21
     */
22
    public function execute()
23
    {
24
        $subSellerId = (int) $this->getRequest()->getParam('subseller');
25
26
        $this->_coreRegistry->register(RegistryConstants::CURRENT_SUB_SELLER_ID, $subSellerId);
0 ignored issues
show
Deprecated Code introduced by
The function Magento\Framework\Registry::register() has been deprecated: 102.0.0 ( Ignorable by Annotation )

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

26
        /** @scrutinizer ignore-deprecated */ $this->_coreRegistry->register(RegistryConstants::CURRENT_SUB_SELLER_ID, $subSellerId);

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...
27
28
        try {
29
            $subSellerDataObject = $this->_subSellerRepository->get($subSellerId);
30
        } catch (NoSuchEntityException $e) {
31
            /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
32
            $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
33
34
            return $resultRedirect->setPath('*/*/');
35
        }
36
37
        $resultPage = $this->initResultPage();
38
        $layout = $resultPage->getLayout();
39
40
        $toolbarSaveBlock = $layout->createBlock(\Getnet\SubSellerMagento\Block\Adminhtml\SubSeller\Toolbar\Save::class)
41
            ->assign('header', __('Edit Sub Seller'))
0 ignored issues
show
The method assign() does not exist on Magento\Framework\View\Element\BlockInterface. It seems like you code against a sub-type of said class. However, the method does not exist in Magento\Framework\View\T...DataSourcePoolTestBlock or Magento\Framework\View\E...ontrol\ControlInterface or Magento\Framework\View\E...nent\ContainerInterface or Magento\Framework\View\T...Unit\BlockPoolTestBlock or Magento\Ui\Block\Compone...epsWizard\StepInterface or Magento\Framework\View\E...nt\UiComponentInterface or Magento\Framework\View\E...onent\JsConfigInterface or Magento\Framework\View\E...ent\DataSourceInterface or Magento\Ui\Component\Form\Element\ElementInterface or Magento\Ui\Component\For...aType\DataTypeInterface or Magento\Framework\View\E...t\BlockWrapperInterface or Magento\Ui\Component\Lis...Columns\ColumnInterface. Are you sure you never get one of those? ( Ignorable by Annotation )

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

41
            ->/** @scrutinizer ignore-call */ assign('header', __('Edit Sub Seller'))
Loading history...
42
            ->assign(
43
                'form',
44
                $layout->createBlock(
45
                    \Getnet\SubSellerMagento\Block\Adminhtml\SubSeller\Form::class,
46
                    'subSeller_form'
47
                )->setShowLegend(true)
0 ignored issues
show
The method setShowLegend() does not exist on Magento\Framework\View\Element\BlockInterface. It seems like you code against a sub-type of said class. However, the method does not exist in Magento\Framework\View\T...DataSourcePoolTestBlock or Magento\Framework\View\E...ontrol\ControlInterface or Magento\Framework\View\E...nent\ContainerInterface or Magento\Framework\View\T...Unit\BlockPoolTestBlock or Magento\Ui\Block\Compone...epsWizard\StepInterface or Magento\Framework\View\E...nt\UiComponentInterface or Magento\Framework\View\E...onent\JsConfigInterface or Magento\Framework\View\E...ent\DataSourceInterface or Magento\Ui\Component\Form\Element\ElementInterface or Magento\Ui\Component\For...aType\DataTypeInterface or Magento\Framework\View\E...t\BlockWrapperInterface or Magento\Ui\Component\Lis...Columns\ColumnInterface. Are you sure you never get one of those? ( Ignorable by Annotation )

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

47
                )->/** @scrutinizer ignore-call */ setShowLegend(true)
Loading history...
48
            );
49
50
        $resultPage->addBreadcrumb(
51
            __('Manage Sub Sellers'),
52
            __('Manage Sub Sellers'),
53
            $this->getUrl('subsller/subseller')
54
        )->addBreadcrumb(__('Edit Sub Seller'), __('Edit Sub Seller'))
55
        ->addContent($toolbarSaveBlock);
56
57
        $resultPage->getConfig()->getTitle()->prepend(__('Getnet Sub Sellers'));
58
        $resultPage->getConfig()->getTitle()->prepend(__('Sub Seller Code: %1', $subSellerDataObject->getCode()));
59
60
        return $resultPage;
61
    }
62
}
63