Increment.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sales\Model;
  7. use Magento\Eav\Model\Config as EavConfig;
  8. /**
  9. * Class Increment
  10. * @deprecated 101.0.0
  11. */
  12. class Increment
  13. {
  14. /**
  15. * @var \Magento\Eav\Model\Config
  16. */
  17. protected $eavConfig;
  18. /**
  19. * @var string
  20. */
  21. protected $incrementValue;
  22. /**
  23. * @param EavConfig $eavConfig
  24. */
  25. public function __construct(
  26. EavConfig $eavConfig
  27. ) {
  28. $this->eavConfig = $eavConfig;
  29. }
  30. /**
  31. * Returns current increment id
  32. *
  33. * @return string
  34. */
  35. public function getCurrentValue()
  36. {
  37. return $this->incrementValue;
  38. }
  39. /**
  40. * Returns new value of increment id
  41. *
  42. * @param int $storeId
  43. * @return string
  44. * @throws \Exception
  45. * @throws \Magento\Framework\Exception\LocalizedException
  46. */
  47. public function getNextValue($storeId)
  48. {
  49. $this->incrementValue =
  50. $this->eavConfig->getEntityType(Order::ENTITY)->fetchNewIncrementId($storeId);
  51. return $this->incrementValue;
  52. }
  53. }