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