DispatchUrl.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. /**
  3. * Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
  4. */
  5. namespace Temando\Shipping\ViewModel\DataProvider;
  6. use Magento\Framework\UrlInterface;
  7. use Temando\Shipping\Model\DispatchInterface;
  8. /**
  9. * Dispatch URL provider
  10. *
  11. * @package Temando\Shipping\ViewModel
  12. * @author Christoph Aßmann <christoph.assmann@netresearch.de>
  13. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  14. * @link http://www.temando.com/
  15. */
  16. class DispatchUrl implements EntityUrlInterface
  17. {
  18. /**
  19. * Url Builder
  20. *
  21. * @var UrlInterface
  22. */
  23. private $urlBuilder;
  24. /**
  25. * CarrierUrl constructor.
  26. * @param UrlInterface $urlBuilder
  27. */
  28. public function __construct(UrlInterface $urlBuilder)
  29. {
  30. $this->urlBuilder = $urlBuilder;
  31. }
  32. /**
  33. * @return string
  34. */
  35. public function getNewActionUrl(): string
  36. {
  37. return $this->urlBuilder->getUrl('temando/dispatch/new');
  38. }
  39. /**
  40. * @return string
  41. */
  42. public function getListActionUrl(): string
  43. {
  44. return $this->urlBuilder->getUrl('temando/dispatch/index');
  45. }
  46. /**
  47. * @param mixed[] $data Item data to pick entity identifier.
  48. * @return string
  49. */
  50. public function getViewActionUrl(array $data): string
  51. {
  52. return $this->urlBuilder->getUrl('temando/dispatch/view', [
  53. DispatchInterface::DISPATCH_ID => $data[DispatchInterface::DISPATCH_ID],
  54. ]);
  55. }
  56. /**
  57. * @param mixed[] $data Item data to pick entity identifier.
  58. * @return string
  59. */
  60. public function getEditActionUrl(array $data): string
  61. {
  62. return '';
  63. }
  64. /**
  65. * @param mixed[] $data Item data for the implementer to pick entity identifier.
  66. * @return string
  67. */
  68. public function getDeleteActionUrl(array $data): string
  69. {
  70. return '';
  71. }
  72. /**
  73. * @param mixed[] $data Item data to pick entity identifier.
  74. * @return string
  75. */
  76. public function getSolveActionUrl(array $data): string
  77. {
  78. return $this->urlBuilder->getUrl('temando/dispatch/solve', [
  79. DispatchInterface::DISPATCH_ID => $data[DispatchInterface::DISPATCH_ID],
  80. ]);
  81. }
  82. }