@@ 104-111 (lines=8) @@ | ||
101 | /** |
|
102 | * {@inheritdoc} |
|
103 | */ |
|
104 | public function getIriFromResourceClass(string $resourceClass, int $referenceType = UrlGeneratorInterface::ABS_PATH): string |
|
105 | { |
|
106 | try { |
|
107 | return $this->router->generate($this->routeNameResolver->getRouteName($resourceClass, OperationType::COLLECTION), [], $referenceType); |
|
108 | } catch (RoutingExceptionInterface $e) { |
|
109 | throw new InvalidArgumentException(sprintf('Unable to generate an IRI for "%s".', $resourceClass), $e->getCode(), $e); |
|
110 | } |
|
111 | } |
|
112 | ||
113 | /** |
|
114 | * {@inheritdoc} |
|
@@ 116-122 (lines=7) @@ | ||
113 | /** |
|
114 | * {@inheritdoc} |
|
115 | */ |
|
116 | public function getItemIriFromResourceClass(string $resourceClass, array $identifiers, int $referenceType = UrlGeneratorInterface::ABS_PATH): string |
|
117 | { |
|
118 | try { |
|
119 | return $this->router->generate($this->routeNameResolver->getRouteName($resourceClass, OperationType::ITEM), $identifiers, $referenceType); |
|
120 | } catch (RoutingExceptionInterface $e) { |
|
121 | throw new InvalidArgumentException(sprintf('Unable to generate an IRI for "%s".', $resourceClass), $e->getCode(), $e); |
|
122 | } |
|
123 | } |
|
124 | ||
125 | /** |
|
@@ 128-135 (lines=8) @@ | ||
125 | /** |
|
126 | * {@inheritdoc} |
|
127 | */ |
|
128 | public function getSubresourceIriFromResourceClass(string $resourceClass, array $identifiers, int $referenceType = UrlGeneratorInterface::ABS_PATH): string |
|
129 | { |
|
130 | try { |
|
131 | return $this->router->generate($this->routeNameResolver->getRouteName($resourceClass, OperationType::SUBRESOURCE), $identifiers, $referenceType); |
|
132 | } catch (RoutingExceptionInterface $e) { |
|
133 | throw new InvalidArgumentException(sprintf('Unable to generate an IRI for "%s".', $resourceClass), $e->getCode(), $e); |
|
134 | } |
|
135 | } |
|
136 | ||
137 | /** |
|
138 | * Generate the identifier url. |