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