Issues (3641)

MerchantExportMerchantsMessageHandlerPlugin.php (1 issue)

1
<?php
2
3
/**
4
 * Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace Spryker\Zed\Merchant\Communication\Plugin\MessageBroker;
9
10
use Generated\Shared\Transfer\ExportMerchantsTransfer;
11
use Generated\Shared\Transfer\MerchantExportCriteriaTransfer;
12
use Spryker\Zed\Kernel\Communication\AbstractPlugin;
13
use Spryker\Zed\MessageBrokerExtension\Dependency\Plugin\MessageHandlerPluginInterface;
14
15
/**
16
 * @deprecated Use {@link \Spryker\Zed\Merchant\Communication\Plugin\MessageBroker\MerchantMessageHandlerPlugin} instead.
17
 *
18
 * @method \Spryker\Zed\Merchant\Business\MerchantFacadeInterface getFacade()
19
 * @method \Spryker\Zed\Merchant\Communication\MerchantCommunicationFactory getFactory()
20
 * @method \Spryker\Zed\Merchant\MerchantConfig getConfig()
21
 */
22
class MerchantExportMerchantsMessageHandlerPlugin extends AbstractPlugin implements MessageHandlerPluginInterface
23
{
24
    /**
25
     * {@inheritDoc}
26
     * - Triggers Merchant.exported event for all Merchants
27
     *
28
     * @api
29
     *
30
     * @param \Generated\Shared\Transfer\ExportMerchantsTransfer $exportMerchantsTransfer
31
     *
32
     * @return void
33
     */
34
    public function onExportMerchants(ExportMerchantsTransfer $exportMerchantsTransfer): void
35
    {
36
        $merchantExportCriteriaTransfer = (new MerchantExportCriteriaTransfer())->setStoreReference($exportMerchantsTransfer->getMessageAttributesOrFail()->getStoreReferenceOrFail());
37
        $this->getFacade()->triggerMerchantExportEvents($merchantExportCriteriaTransfer);
38
    }
39
40
    /**
41
     * {@inheritDoc}
42
     *
43
     * @api
44
     *
45
     * @return array<string, callable>
46
     */
47
    public function handles(): iterable
48
    {
49
        yield ExportMerchantsTransfer::class => [$this, 'onExportMerchants'];
0 ignored issues
show
Bug Best Practice introduced by
The expression yield Generated\Shared\T...s, 'onExportMerchants') returns the type Generator which is incompatible with the documented return type array<string,callable>.
Loading history...
50
    }
51
}
52