1 | <?php |
||||
2 | declare(strict_types=1); |
||||
3 | /** |
||||
4 | */ |
||||
5 | |||||
6 | namespace CommerceLeague\ActiveCampaign\Cron; |
||||
7 | |||||
8 | |||||
9 | use CommerceLeague\ActiveCampaign\Helper\Config as ConfigHelper; |
||||
10 | use CommerceLeague\ActiveCampaign\MessageQueue\Topics; |
||||
11 | use CommerceLeague\ActiveCampaign\Model\ResourceModel\Customer\Collection as CustomerCollection; |
||||
12 | use CommerceLeague\ActiveCampaign\Model\ResourceModel\Customer\CollectionFactory as CustomerCollectionFactory; |
||||
0 ignored issues
–
show
|
|||||
13 | use Magento\Framework\MessageQueue\PublisherInterface; |
||||
14 | |||||
15 | /** |
||||
16 | * Class ExportOmittedCustomers |
||||
17 | */ |
||||
18 | class ExportOmittedCustomers implements CronInterface |
||||
19 | { |
||||
20 | /** |
||||
21 | * @var ConfigHelper |
||||
22 | */ |
||||
23 | private $configHelper; |
||||
24 | |||||
25 | /** |
||||
26 | * @var CustomerCollectionFactory |
||||
27 | */ |
||||
28 | private $customerCollectionFactory; |
||||
29 | |||||
30 | /** |
||||
31 | * @var PublisherInterface |
||||
32 | */ |
||||
33 | private $publisher; |
||||
34 | |||||
35 | /** |
||||
36 | * @param ConfigHelper $configHelper |
||||
37 | * @param CustomerCollectionFactory $customerCollectionFactory |
||||
38 | * @param PublisherInterface $publisher |
||||
39 | */ |
||||
40 | public function __construct( |
||||
41 | ConfigHelper $configHelper, |
||||
42 | CustomerCollectionFactory $customerCollectionFactory, |
||||
43 | PublisherInterface $publisher |
||||
44 | ) { |
||||
45 | $this->configHelper = $configHelper; |
||||
46 | $this->customerCollectionFactory = $customerCollectionFactory; |
||||
47 | $this->publisher = $publisher; |
||||
48 | } |
||||
49 | |||||
50 | /** |
||||
51 | * @inheritDoc |
||||
52 | */ |
||||
53 | public function run(): void |
||||
54 | { |
||||
55 | if (!$this->configHelper->isEnabled() || !$this->configHelper->isCustomerExportEnabled()) { |
||||
56 | return; |
||||
57 | } |
||||
58 | |||||
59 | $customerIds = $this->getCustomerIds(); |
||||
60 | |||||
61 | foreach ($customerIds as $customerId) { |
||||
62 | $this->publisher->publish( |
||||
63 | Topics::CUSTOMER_CUSTOMER_EXPORT, |
||||
64 | json_encode(['magento_customer_id' => $customerId]) |
||||
0 ignored issues
–
show
json_encode(array('magen...er_id' => $customerId)) of type string is incompatible with the type array|object expected by parameter $data of Magento\Framework\Messag...herInterface::publish() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
65 | ); |
||||
66 | } |
||||
67 | } |
||||
68 | |||||
69 | /** |
||||
70 | * @return array |
||||
71 | */ |
||||
72 | private function getCustomerIds(): array |
||||
73 | { |
||||
74 | /** @var CustomerCollection $customerCollection */ |
||||
75 | $customerCollection = $this->customerCollectionFactory->create(); |
||||
76 | $customerCollection->addCustomerOmittedFilter(); |
||||
77 | |||||
78 | return $customerCollection->getAllIds(); |
||||
79 | } |
||||
80 | } |
||||
81 |
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