Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ReindexAfterSourceItemsDeletePlugin.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
13 
18 {
22  private $sourceIndexer;
23 
27  public function __construct(SourceIndexer $sourceIndexer)
28  {
29  $this->sourceIndexer = $sourceIndexer;
30  }
31 
39  public function aroundExecute(
41  callable $proceed,
42  array $sourceItems
43  ) {
44  $sourceCodes = [];
45  foreach ($sourceItems as $sourceItem) {
46  $sourceCodes[] = $sourceItem->getSourceCode();
47  }
48 
49  $proceed($sourceItems);
50 
51  if (count($sourceCodes)) {
52  $this->sourceIndexer->executeList($sourceCodes);
53  }
54  }
55 }
aroundExecute(SourceItemsDeleteInterface $subject, callable $proceed, array $sourceItems)
$sourceItems