|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* MagePrince |
|
4
|
|
|
* |
|
5
|
|
|
* NOTICE OF LICENSE |
|
6
|
|
|
* |
|
7
|
|
|
* This source file is subject to the mageprince.com license that is |
|
8
|
|
|
* available through the world-wide-web at this URL: |
|
9
|
|
|
* https://mageprince.com/end-user-license-agreement |
|
10
|
|
|
* |
|
11
|
|
|
* DISCLAIMER |
|
12
|
|
|
* |
|
13
|
|
|
* Do not edit or add to this file if you wish to upgrade this extension to newer |
|
14
|
|
|
* version in the future. |
|
15
|
|
|
* |
|
16
|
|
|
* @category MagePrince |
|
17
|
|
|
* @package Mageprince_Faq |
|
18
|
|
|
* @copyright Copyright (c) MagePrince (https://mageprince.com/) |
|
19
|
|
|
* @license https://mageprince.com/end-user-license-agreement |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
namespace Mageprince\Faq\Controller\Adminhtml\FaqGroup; |
|
23
|
|
|
|
|
24
|
|
|
use Magento\Backend\App\Action\Context; |
|
|
|
|
|
|
25
|
|
|
use Magento\Backend\Model\View\Result\Redirect; |
|
|
|
|
|
|
26
|
|
|
use Magento\Framework\Controller\ResultInterface; |
|
|
|
|
|
|
27
|
|
|
use Mageprince\Faq\Model\FaqGroupRepository; |
|
28
|
|
|
|
|
29
|
|
|
class Delete extends FaqGroup |
|
30
|
|
|
{ |
|
31
|
|
|
/** |
|
32
|
|
|
* @var FaqGroupRepository |
|
33
|
|
|
*/ |
|
34
|
|
|
protected $faqGroupRepository; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Delete constructor. |
|
38
|
|
|
* @param Context $context |
|
39
|
|
|
* @param FaqGroupRepository $faqGroupRepository |
|
40
|
|
|
*/ |
|
41
|
|
|
public function __construct( |
|
42
|
|
|
Context $context, |
|
43
|
|
|
FaqGroupRepository $faqGroupRepository |
|
44
|
|
|
) { |
|
45
|
|
|
$this->faqGroupRepository = $faqGroupRepository; |
|
46
|
|
|
parent::__construct($context); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Delete action |
|
51
|
|
|
* |
|
52
|
|
|
* @return ResultInterface |
|
53
|
|
|
*/ |
|
54
|
|
|
public function execute() |
|
55
|
|
|
{ |
|
56
|
|
|
/** @var Redirect $resultRedirect */ |
|
57
|
|
|
$resultRedirect = $this->resultRedirectFactory->create(); |
|
58
|
|
|
$id = $this->getRequest()->getParam('faqgroup_id'); |
|
59
|
|
|
if ($id) { |
|
60
|
|
|
try { |
|
61
|
|
|
$this->faqGroupRepository->deleteById($id); |
|
62
|
|
|
$this->messageManager->addSuccessMessage(__('You deleted the Faq Group.')); |
|
|
|
|
|
|
63
|
|
|
return $resultRedirect->setPath('*/*/'); |
|
64
|
|
|
} catch (\Exception $e) { |
|
65
|
|
|
$this->messageManager->addErrorMessage($e->getMessage()); |
|
66
|
|
|
return $resultRedirect->setPath('*/*/edit', ['faqgroup_id' => $id]); |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
$this->messageManager->addErrorMessage(__('We can\'t find a Faq Group to delete.')); |
|
70
|
|
|
return $resultRedirect->setPath('*/*/'); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths