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