SequenceRegistry.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\EntityManager\Sequence;
  7. use Magento\Framework\DB\Sequence\SequenceInterface;
  8. /**
  9. * Class SequenceRegistry
  10. */
  11. class SequenceRegistry
  12. {
  13. /**
  14. * @var array
  15. */
  16. private $registry;
  17. /**
  18. * Register information about existing sequence
  19. *
  20. * @param string $entityType
  21. * @param SequenceInterface|null $sequence
  22. * @param string|null $sequenceTable
  23. * @return void
  24. */
  25. public function register($entityType, $sequence = null, $sequenceTable = null)
  26. {
  27. $this->registry[$entityType]['sequence'] = $sequence;
  28. $this->registry[$entityType]['sequenceTable'] = $sequenceTable;
  29. }
  30. /**
  31. * Returns sequence information
  32. *
  33. * @param string $entityType
  34. * @return bool|array
  35. */
  36. public function retrieve($entityType)
  37. {
  38. if (isset($this->registry[$entityType])) {
  39. return $this->registry[$entityType];
  40. }
  41. return false;
  42. }
  43. }