|
@@ 119-126 (lines=8) @@
|
| 116 |
|
/** |
| 117 |
|
* {@inheritdoc} |
| 118 |
|
*/ |
| 119 |
|
public function getIriFromResourceClass(string $resourceClass, int $referenceType = UrlGeneratorInterface::ABS_PATH): string |
| 120 |
|
{ |
| 121 |
|
try { |
| 122 |
|
return $this->router->generate($this->routeNameResolver->getRouteName($resourceClass, OperationType::COLLECTION), [], $referenceType); |
| 123 |
|
} catch (RoutingExceptionInterface $e) { |
| 124 |
|
throw new InvalidArgumentException(sprintf('Unable to generate an IRI for "%s".', $resourceClass), $e->getCode(), $e); |
| 125 |
|
} |
| 126 |
|
} |
| 127 |
|
|
| 128 |
|
/** |
| 129 |
|
* {@inheritdoc} |
|
@@ 131-137 (lines=7) @@
|
| 128 |
|
/** |
| 129 |
|
* {@inheritdoc} |
| 130 |
|
*/ |
| 131 |
|
public function getItemIriFromResourceClass(string $resourceClass, array $identifiers, int $referenceType = UrlGeneratorInterface::ABS_PATH): string |
| 132 |
|
{ |
| 133 |
|
try { |
| 134 |
|
return $this->router->generate($this->routeNameResolver->getRouteName($resourceClass, OperationType::ITEM), $identifiers, $referenceType); |
| 135 |
|
} catch (RoutingExceptionInterface $e) { |
| 136 |
|
throw new InvalidArgumentException(sprintf('Unable to generate an IRI for "%s".', $resourceClass), $e->getCode(), $e); |
| 137 |
|
} |
| 138 |
|
} |
| 139 |
|
|
| 140 |
|
/** |
|
@@ 159-166 (lines=8) @@
|
| 156 |
|
/** |
| 157 |
|
* {@inheritdoc} |
| 158 |
|
*/ |
| 159 |
|
public function getSubresourceIriFromResourceClass(string $resourceClass, array $context, int $referenceType = UrlGeneratorInterface::ABS_PATH): string |
| 160 |
|
{ |
| 161 |
|
try { |
| 162 |
|
return $this->router->generate($this->routeNameResolver->getRouteName($resourceClass, OperationType::SUBRESOURCE, $context), $context['subresource_identifiers'], $referenceType); |
| 163 |
|
} catch (RoutingExceptionInterface $e) { |
| 164 |
|
throw new InvalidArgumentException(sprintf('Unable to generate an IRI for "%s".', $resourceClass), $e->getCode(), $e); |
| 165 |
|
} |
| 166 |
|
} |
| 167 |
|
|
| 168 |
|
/** |
| 169 |
|
* Generate the identifier url. |