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