-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathProductGalleryApiQueueProcess.php
70 lines (60 loc) · 1.7 KB
/
ProductGalleryApiQueueProcess.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
namespace Cloudinary\Cloudinary\Command;
use Magento\Framework\App\State as AppState;
use Magento\Framework\ObjectManagerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class ProductGalleryApiQueueProcess extends Command
{
/**
* @var ObjectManagerInterface
*/
private $objectManager;
/**
* @var AppState
*/
private $appState;
/**
* @var $job
*/
protected $job;
/**
* @method __construct
* @param ObjectManagerInterface $objectManager
* @param AppState $appState
*/
public function __construct(
ObjectManagerInterface $objectManager,
AppState $appState
) {
parent::__construct('cloudinary:product-gallery-api-queue:process');
$this->objectManager = $objectManager;
$this->appState = $appState;
}
/**
* Configure the command
*
* @return void
*/
protected function configure()
{
$this->setName('cloudinary:product-gallery-api-queue:process');
$this->setDescription('Process queued items for product gallery API');
}
/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->job = $this->objectManager
->get(\Cloudinary\Cloudinary\Cron\ProductGalleryApiQueue::class);
$this->appState->setAreaCode(\Magento\Framework\App\Area::AREA_CRONTAB);
return $this->job
->setOutput($output)
->execute();
}
}