SalesEventToArrayConverter.php 742 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\InventorySales\Model;
  8. use Magento\InventorySalesApi\Api\Data\SalesEventInterface;
  9. /**
  10. * @inheritdoc
  11. */
  12. class SalesEventToArrayConverter
  13. {
  14. /**
  15. * Converts sales event data to array structure, which can be serialized to JSON
  16. *
  17. * @param SalesEventInterface $salesEvent
  18. * @return array
  19. */
  20. public function execute(SalesEventInterface $salesEvent): array
  21. {
  22. return [
  23. 'event_type' => $salesEvent->getType(),
  24. 'object_type' => $salesEvent->getObjectType(),
  25. 'object_id' => $salesEvent->getObjectId(),
  26. ];
  27. }
  28. }