Spamworldpro Mini Shell
Spamworldpro


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/amasty/feed/Controller/Adminhtml/Category/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/amasty/feed/Controller/Adminhtml/Category/Edit.php
<?php
/**
 * @author Amasty Team
 * @copyright Copyright (c) Amasty (https://www.amasty.com)
 * @package Product Feed for Magento 2
 */

namespace Amasty\Feed\Controller\Adminhtml\Category;

use Amasty\Feed\Controller\Adminhtml\AbstractCategory;
use Amasty\Feed\Model\Category\CategoryFactory;
use Amasty\Feed\Model\Category\Repository;
use Magento\Backend\App\Action;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Registry;

class Edit extends AbstractCategory
{
    /**
     * @var Registry
     */
    private $registry;

    /**
     * @var Repository
     */
    private $repository;

    /**
     * @var CategoryFactory
     */
    private $categoryFactory;

    public function __construct(
        Action\Context $context,
        Registry $registry,
        Repository $repository,
        CategoryFactory $categoryFactory
    ) {
        parent::__construct($context);
        $this->registry = $registry;
        $this->repository = $repository;
        $this->categoryFactory = $categoryFactory;
    }

    public function execute()
    {
        $model = $this->categoryFactory->create();
        if ($categoryId = $this->getRequest()->getParam('feed_category_id')) {
            try {
                $model = $this->repository->getById($categoryId);
            } catch (NoSuchEntityException $exception) {
                $this->messageManager->addErrorMessage(__('This category no longer exists.'));

                return $this->resultRedirectFactory->create()->setPath('amfeed/*');
            } catch (\Exception $exception) {
                $this->messageManager->addErrorMessage($exception->getMessage());

                return $this->resultRedirectFactory->create()->setPath('amfeed/*');
            }
        }

        // set entered data if was error when we do save
        $data = $this->_session->getPageData(true);
        if (!empty($data)) {
            $model->addData($data);
        }

        $this->registry->register('current_amfeed_category', $model);

        /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
        $resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
        $resultPage->setActiveMenu('Amasty_Feed::feed_category');
        $resultPage->addBreadcrumb(__('Amasty Feed'), __('Amasty Feed'));
        $resultPage->addBreadcrumb(__('Categories Mapping Edit'), __('Categories Mapping Edit'));
        $resultPage->getConfig()->getTitle()->prepend(
            $model->getFeedCategoryId() ? $model->getName() : __('New Categories Mapping')
        );

        return $resultPage;
    }
}

Spamworldpro Mini