BatchIteratorInterface.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\DB\Query;
  7. /**
  8. * Batch Iterator interface
  9. */
  10. interface BatchIteratorInterface extends \Iterator
  11. {
  12. /**
  13. * Constant which determine strategy to create iterator which will to process
  14. * range field eg. entity_id with unique values.
  15. */
  16. const UNIQUE_FIELD_ITERATOR = "unique";
  17. /**
  18. * Constant which determine strategy to create iterator which will to process
  19. * range field with non-unique values.
  20. */
  21. const NON_UNIQUE_FIELD_ITERATOR = "non_unqiue";
  22. /**
  23. * Return the current element
  24. *
  25. * If we don't have sub-select we should create and remember it.
  26. *
  27. * @return \Magento\Framework\DB\Select
  28. */
  29. public function current();
  30. /**
  31. * Return the key of the current element
  32. *
  33. * Сan return the number of the current sub-select in the iteration.
  34. *
  35. * @return int
  36. */
  37. public function key();
  38. /**
  39. * Move forward to next sub-select
  40. *
  41. * Retrieve the next sub-select and move cursor to the next element.
  42. * Checks that the count of elements more than the sum of limit and offset.
  43. *
  44. * @return \Magento\Framework\DB\Select
  45. */
  46. public function next();
  47. /**
  48. * Rewind the BatchRangeIterator to the first element.
  49. *
  50. * Allows to start iteration from the beginning.
  51. *
  52. * @return void
  53. */
  54. public function rewind();
  55. /**
  56. * Checks if current position is valid
  57. *
  58. * @return bool
  59. */
  60. public function valid();
  61. }