CollectionPointSearchResult.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
  4. */
  5. namespace Temando\Shipping\Model\ResourceModel\CollectionPoint;
  6. use Magento\Framework\Api\SearchCriteriaInterface;
  7. use Magento\Framework\Data\Collection;
  8. use Temando\Shipping\Api\Data\CollectionPoint\CollectionPointSearchResultInterface;
  9. use Temando\Shipping\Api\Data\CollectionPoint\QuoteCollectionPointInterface;
  10. /**
  11. * Collection point collection
  12. *
  13. * @deprecated since 1.4.0
  14. * @see \Temando\Shipping\Model\ResourceModel\Delivery\CollectionPointSearchResult
  15. *
  16. * @package Temando\Shipping\Model
  17. * @author Christoph Aßmann <christoph.assmann@netresearch.de>
  18. * @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  19. * @link https://www.temando.com/
  20. */
  21. class CollectionPointSearchResult extends Collection implements CollectionPointSearchResultInterface
  22. {
  23. /**
  24. * @var \Magento\Framework\Api\SearchCriteriaInterface
  25. */
  26. private $searchCriteria;
  27. /**
  28. * Get search criteria.
  29. *
  30. * @return \Magento\Framework\Api\SearchCriteriaInterface|null
  31. */
  32. public function getSearchCriteria()
  33. {
  34. return $this->searchCriteria;
  35. }
  36. /**
  37. * Set search criteria.
  38. *
  39. * @param SearchCriteriaInterface $searchCriteria
  40. * @return $this
  41. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  42. */
  43. public function setSearchCriteria(SearchCriteriaInterface $searchCriteria = null)
  44. {
  45. $this->searchCriteria = $searchCriteria;
  46. return $this;
  47. }
  48. /**
  49. * Get total count.
  50. *
  51. * @return int
  52. */
  53. public function getTotalCount()
  54. {
  55. return $this->getSize();
  56. }
  57. /**
  58. * Not applicable, Collection vs. Search Result seems to be work in progress.
  59. *
  60. * @param int $totalCount
  61. * @return $this
  62. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  63. */
  64. public function setTotalCount($totalCount)
  65. {
  66. return $this;
  67. }
  68. /**
  69. * Set items list.
  70. *
  71. * @param QuoteCollectionPointInterface[] $items
  72. * @return $this
  73. * @throws \Exception
  74. */
  75. public function setItems(array $items = null)
  76. {
  77. if (!$items) {
  78. return $this;
  79. }
  80. foreach ($items as $item) {
  81. $this->addItem($item);
  82. }
  83. return $this;
  84. }
  85. }