Skip to content

Commit 4572822

Browse files
committed
Fix call to undefined method
1 parent 730510e commit 4572822

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Controller/Adminhtml/Config/Job/MassScheduleNow.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
namespace EthanYehuda\CronjobManager\Controller\Adminhtml\Config\Job;
44

5-
use EthanYehuda\CronjobManager\Model\ManagerFactory;
6-
use Magento\Framework\View\Result\PageFactory;
5+
use EthanYehuda\CronjobManager\Model\ScheduleManagement;
76
use Magento\Backend\App\Action\Context;
87
use Magento\Backend\App\Action;
98

@@ -13,11 +12,11 @@ class MassScheduleNow extends Action
1312

1413
/**
1514
* @param Context $context
16-
* @param ManagerFactory $managerFactory
15+
* @param ScheduleManagement $scheduleManagement
1716
*/
1817
public function __construct(
1918
Context $context,
20-
private readonly ManagerFactory $managerFactory,
19+
private readonly ScheduleManagement $scheduleManagement,
2120
) {
2221
parent::__construct($context);
2322
}
@@ -29,17 +28,16 @@ public function __construct(
2928
*/
3029
public function execute()
3130
{
32-
$manager = $this->managerFactory->create();
3331
$params = $this->getRequest()->getParam('selected');
3432
if (!isset($params)) {
35-
$this->getMessageManager()->addErrorMessage("Something went wrong when recieving the request");
33+
$this->getMessageManager()->addErrorMessage("Something went wrong when receiving the request");
3634
$this->_redirect('*/config/index');
3735
return;
3836
}
3937

4038
try {
4139
foreach ($params as $jobCode) {
42-
$manager->scheduleNow($jobCode);
40+
$this->scheduleManagement->scheduleNow($jobCode);
4341
}
4442
} catch (\Exception $e) {
4543
$this->getMessageManager()->addErrorMessage($e->getMessage());

0 commit comments

Comments
 (0)