GridAsyncInsert.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sales\Cron;
  7. /**
  8. * Sales entity grids indexing observer.
  9. *
  10. * Performs handling cron jobs related to indexing
  11. * of Order, Invoice, Shipment and Creditmemo grids.
  12. */
  13. class GridAsyncInsert
  14. {
  15. /**
  16. * @var \Magento\Sales\Model\GridAsyncInsert
  17. */
  18. protected $asyncInsert;
  19. /**
  20. * @param \Magento\Sales\Model\GridAsyncInsert $asyncInsert
  21. */
  22. public function __construct(
  23. \Magento\Sales\Model\GridAsyncInsert $asyncInsert
  24. ) {
  25. $this->asyncInsert = $asyncInsert;
  26. }
  27. /**
  28. * Handles asynchronous insertion of the new entity into
  29. * corresponding grid during cron job.
  30. *
  31. * Also method is used in the next events:
  32. *
  33. * - config_data_dev_grid_async_indexing_disabled
  34. *
  35. * Works only if asynchronous grid indexing is enabled
  36. * in global settings.
  37. *
  38. * @return void
  39. */
  40. public function execute()
  41. {
  42. $this->asyncInsert->asyncInsert();
  43. }
  44. }