src/EntityToJsonApi.php | 4 ++-- src/ResourceType/ResourceType.php | 8 ++++---- src/ResourceType/ResourceTypeRepository.php | 2 +- src/ResourceType/ResourceTypeRepositoryInterface.php | 8 ++++---- src/Routing/Routes.php | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/EntityToJsonApi.php b/src/EntityToJsonApi.php index 6549639..99ba536 100644 --- a/src/EntityToJsonApi.php +++ b/src/EntityToJsonApi.php @@ -98,12 +98,12 @@ class EntityToJsonApi { */ protected function calculateContext(EntityInterface $entity) { // TODO: Supporting includes requires adding the 'include' query string. - $path_prefix = $this->resourceTypeRepository->getPathPrefix(); + $path_prefix = $this->resourceTypeRepository->getPrefixPathSegment(); $resource_type = $this->resourceTypeRepository->get( $entity->getEntityTypeId(), $entity->bundle() ); - $resource_path = $resource_type->getPath(); + $resource_path = $resource_type->getPathSegments(); $path = sprintf('%s%s/%s', $path_prefix, $resource_path, $entity->uuid()); $request = Request::create($path, 'GET'); return [ diff --git a/src/ResourceType/ResourceType.php b/src/ResourceType/ResourceType.php index 571abaf..ff06954 100644 --- a/src/ResourceType/ResourceType.php +++ b/src/ResourceType/ResourceType.php @@ -244,14 +244,14 @@ class ResourceType { } /** - * Gets the resource path. + * Gets the resource type path segments. * * @return string - * The path to access this resource type, without path prefix. + * The path segments to access this resource type, without path prefix. * - * @see \Drupal\jsonapi\ResourceType\ResourceTypeRepositoryInterface::getPathPrefix() + * @see \Drupal\jsonapi\ResourceType\ResourceTypeRepositoryInterface::getPrefixPathSegment() */ - public function getPath() { + public function getPathSegments() { return sprintf('/%s/%s', $this->getEntityTypeId(), $this->getBundle()); } diff --git a/src/ResourceType/ResourceTypeRepository.php b/src/ResourceType/ResourceTypeRepository.php index 4448884..7ead907 100644 --- a/src/ResourceType/ResourceTypeRepository.php +++ b/src/ResourceType/ResourceTypeRepository.php @@ -76,7 +76,7 @@ class ResourceTypeRepository implements ResourceTypeRepositoryInterface { /** * {@inheritdoc} */ - public function getPathPrefix() { + public function getPrefixPathSegment() { return '/jsonapi'; } diff --git a/src/ResourceType/ResourceTypeRepositoryInterface.php b/src/ResourceType/ResourceTypeRepositoryInterface.php index 2692522..7d33016 100644 --- a/src/ResourceType/ResourceTypeRepositoryInterface.php +++ b/src/ResourceType/ResourceTypeRepositoryInterface.php @@ -42,13 +42,13 @@ interface ResourceTypeRepositoryInterface { public function getByTypeName($type_name); /** - * Gets the path prefix for routes managed by JSON API. + * Gets the JSON API route prefix path segment. * * @return string - * The route prefix in the JSON API route paths. + * The prefix path segment in the JSON API route paths. * - * @see \Drupal\jsonapi\ResourceType\ResourceType::getPath() + * @see \Drupal\jsonapi\ResourceType\ResourceType::getPathSegments() */ - public function getPathPrefix(); + public function getPrefixPathSegment(); } diff --git a/src/Routing/Routes.php b/src/Routing/Routes.php index b8ddf61..e8d435f 100644 --- a/src/Routing/Routes.php +++ b/src/Routing/Routes.php @@ -80,7 +80,7 @@ class Routes implements ContainerInjectionInterface { public function entryPoint() { $collection = new RouteCollection(); - $path_prefix = $this->resourceTypeRepository->getPathPrefix(); + $path_prefix = $this->resourceTypeRepository->getPrefixPathSegment(); $route_collection = (new Route('/' . $path_prefix, [ RouteObjectInterface::CONTROLLER_NAME => '\Drupal\jsonapi\Controller\EntryPoint::index', ])) @@ -105,8 +105,8 @@ class Routes implements ContainerInjectionInterface { continue; } - $path_prefix = $this->resourceTypeRepository->getPathPrefix(); - $resource_path = $resource_type->getPath(); + $path_prefix = $this->resourceTypeRepository->getPrefixPathSegment(); + $resource_path = $resource_type->getPathSegments(); $route_base_path = sprintf('%s%s', $path_prefix, $resource_path); $build_route_name = function ($key) use ($resource_type) { return sprintf('jsonapi.%s.%s', $resource_type->getTypeName(), $key);