AllSoapAndRest.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\TestModule5\Service\V1;
  7. use Magento\TestModule5\Service\V1\Entity\AllSoapAndRestFactory;
  8. class AllSoapAndRest implements \Magento\TestModule5\Service\V1\AllSoapAndRestInterface
  9. {
  10. /**
  11. * @var AllSoapAndRestFactory
  12. */
  13. protected $factory;
  14. /**
  15. * @param AllSoapAndRestFactory $factory
  16. */
  17. public function __construct(AllSoapAndRestFactory $factory)
  18. {
  19. $this->factory = $factory;
  20. }
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function item($entityId)
  25. {
  26. return $this->factory->create()
  27. ->setEntityId($entityId)
  28. ->setName('testItemName')
  29. ->setIsEnabled(true)
  30. ->setHasOrders(true);
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function items()
  36. {
  37. $allSoapAndRest1 = $this->factory->create()->setEntityId(1)->setName('testProduct1');
  38. $allSoapAndRest2 = $this->factory->create()->setEntityId(2)->setName('testProduct2');
  39. return [$allSoapAndRest1, $allSoapAndRest2];
  40. }
  41. /**
  42. * {@inheritdoc}
  43. */
  44. public function create(\Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $item)
  45. {
  46. return $this->factory->create()
  47. ->setEntityId($item->getEntityId())
  48. ->setName($item->getName())
  49. ->setIsEnabled($item->isEnabled())
  50. ->setHasOrders($item->hasOrders());
  51. }
  52. /**
  53. * {@inheritdoc}
  54. */
  55. public function update(\Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $entityItem)
  56. {
  57. return $entityItem;
  58. }
  59. /**
  60. * {@inheritdoc}
  61. */
  62. public function nestedUpdate(
  63. $parentId,
  64. $entityId,
  65. \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $entityItem
  66. ) {
  67. return $entityItem;
  68. }
  69. }