@@ 125-132 (lines=8) @@ | ||
122 | /** |
|
123 | * {@inheritdoc} |
|
124 | */ |
|
125 | public function getIriFromResourceClass(string $resourceClass, int $referenceType = UrlGeneratorInterface::ABS_PATH): string |
|
126 | { |
|
127 | try { |
|
128 | return $this->router->generate($this->routeNameResolver->getRouteName($resourceClass, OperationType::COLLECTION), [], $referenceType); |
|
129 | } catch (RoutingExceptionInterface $e) { |
|
130 | throw new InvalidArgumentException(sprintf('Unable to generate an IRI for "%s".', $resourceClass), $e->getCode(), $e); |
|
131 | } |
|
132 | } |
|
133 | ||
134 | /** |
|
135 | * {@inheritdoc} |
|
@@ 137-143 (lines=7) @@ | ||
134 | /** |
|
135 | * {@inheritdoc} |
|
136 | */ |
|
137 | public function getItemIriFromResourceClass(string $resourceClass, array $identifiers, int $referenceType = UrlGeneratorInterface::ABS_PATH): string |
|
138 | { |
|
139 | try { |
|
140 | return $this->router->generate($this->routeNameResolver->getRouteName($resourceClass, OperationType::ITEM), $identifiers, $referenceType); |
|
141 | } catch (RoutingExceptionInterface $e) { |
|
142 | throw new InvalidArgumentException(sprintf('Unable to generate an IRI for "%s".', $resourceClass), $e->getCode(), $e); |
|
143 | } |
|
144 | } |
|
145 | ||
146 | /** |
|
@@ 149-156 (lines=8) @@ | ||
146 | /** |
|
147 | * {@inheritdoc} |
|
148 | */ |
|
149 | public function getSubresourceIriFromResourceClass(string $resourceClass, array $context, int $referenceType = UrlGeneratorInterface::ABS_PATH): string |
|
150 | { |
|
151 | try { |
|
152 | return $this->router->generate($this->routeNameResolver->getRouteName($resourceClass, OperationType::SUBRESOURCE, $context), $context['subresource_identifiers'], $referenceType); |
|
153 | } catch (RoutingExceptionInterface $e) { |
|
154 | throw new InvalidArgumentException(sprintf('Unable to generate an IRI for "%s".', $resourceClass), $e->getCode(), $e); |
|
155 | } |
|
156 | } |
|
157 | ||
158 | /** |
|
159 | * Generate the identifier url. |