1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
/** |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
namespace CommerceLeague\ActiveCampaign\Console\Command; |
7
|
|
|
|
8
|
|
|
use CommerceLeague\ActiveCampaign\Helper\AbandonedCart as AbandonedCartHelper; |
9
|
|
|
use CommerceLeague\ActiveCampaign\MessageQueue\Topics; |
10
|
|
|
use Magento\Framework\Console\Cli; |
11
|
|
|
use Magento\Framework\MessageQueue\PublisherInterface; |
12
|
|
|
use Symfony\Component\Console\Helper\ProgressBarFactory; |
|
|
|
|
13
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
14
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Class ExportAbandonedCommand |
18
|
|
|
*/ |
19
|
|
|
class ExportAbandonedCommand extends AbstractExportCommand |
20
|
|
|
{ |
21
|
|
|
private const NAME = 'activecampaign:export:abandoned-cart'; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var AbandonedCartHelper |
25
|
|
|
*/ |
26
|
|
|
private $abandonedCartHelper; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @param AbandonedCartHelper $abandonedCartHelper |
30
|
|
|
* @param ProgressBarFactory $progressBarFactory |
31
|
|
|
* @param PublisherInterface $publisher |
32
|
|
|
*/ |
33
|
|
|
public function __construct( |
34
|
|
|
AbandonedCartHelper $abandonedCartHelper, |
35
|
|
|
ProgressBarFactory $progressBarFactory, |
36
|
|
|
PublisherInterface $publisher |
37
|
|
|
) { |
38
|
|
|
$this->abandonedCartHelper = $abandonedCartHelper; |
39
|
|
|
parent::__construct($progressBarFactory, $publisher); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @inheritDoc |
44
|
|
|
*/ |
45
|
|
|
protected function configure() |
46
|
|
|
{ |
47
|
|
|
$this->setName(self::NAME); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @param InputInterface $input |
52
|
|
|
* @param OutputInterface $output |
53
|
|
|
* @return int|void|null |
54
|
|
|
* @throws \Exception |
55
|
|
|
*/ |
56
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
57
|
|
|
{ |
58
|
|
|
$quoteIds = $this->abandonedCartHelper->getExportCollection()->getAllIds(); |
59
|
|
|
|
60
|
|
|
$progressBar = $this->createProgressBar( |
61
|
|
|
$output, |
62
|
|
|
count($quoteIds), |
63
|
|
|
'Export Abandoned Cart(s)' |
64
|
|
|
); |
65
|
|
|
|
66
|
|
|
foreach ($quoteIds as $quoteId) { |
67
|
|
|
$this->publisher->publish( |
68
|
|
|
Topics::QUOTE_ABANDONED_CART_EXPORT, |
69
|
|
|
json_encode(['quote_id' => $quoteId]) |
|
|
|
|
70
|
|
|
); |
71
|
|
|
|
72
|
|
|
$progressBar->advance(); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
$output->writeln(''); |
76
|
|
|
$output->writeln(sprintf( |
77
|
|
|
'<info>Exported %s abandoned cart(s)</info>', |
78
|
|
|
(count($quoteIds))) |
79
|
|
|
); |
80
|
|
|
|
81
|
|
|
return Cli::RETURN_SUCCESS; |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|
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