From 8292d8cbf405000604b9a6578e3c44bfa4271493 Mon Sep 17 00:00:00 2001 From: gggeek Date: Thu, 29 Sep 2016 18:51:22 +0100 Subject: [PATCH] Allow references to 'path'; test using ezplatform 1.5 instead of 1.4 --- .travis.yml | 4 ++-- Core/Executor/ContentManager.php | 11 +++++++---- Core/Executor/LocationManager.php | 3 +++ Resources/doc/DSL/ManageContent.yml | 2 +- Resources/doc/DSL/ManageLocation.yml | 5 +++++ Resources/doc/DSL/ManageRolesAndPolicies.yml | 2 +- WHATSNEW.md | 3 +++ 7 files changed, 22 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 60a2f12a..1ea4231f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,9 +25,9 @@ matrix: env: EZ_PACKAGES='ezsystems/ezpublish-community:~2014.11.0 ezsystems/behatbundle:~5.4' EZ_VERSION=ezpublish-community EZ_APP_DIR=ezpublish EZ_KERNEL=EzPublishKernel CODE_COVERAGE=1 # latest version currently available of eZPlatform aka eZPublish 6 #- php: 5.6 - # env: EZ_PACKAGES='ezsystems/ezplatform:~1.4.0 ezsystems/behatbundle:~6.3' EZ_VERSION=ezplatform EZ_APP_DIR=app EZ_KERNEL=AppKernel CODE_COVERAGE=0 + # env: EZ_PACKAGES='ezsystems/ezplatform:~1.5.0 ezsystems/behatbundle:^6.3' EZ_VERSION=ezplatform EZ_APP_DIR=app EZ_KERNEL=AppKernel CODE_COVERAGE=0 - php: 7.0 - env: EZ_PACKAGES='ezsystems/ezplatform:~1.4.0 ezsystems/behatbundle:~6.3' EZ_VERSION=ezplatform EZ_APP_DIR=app EZ_KERNEL=AppKernel CODE_COVERAGE=0 + env: EZ_PACKAGES='ezsystems/ezplatform:~1.5.0 ezsystems/behatbundle:^6.3' EZ_VERSION=ezplatform EZ_APP_DIR=app EZ_KERNEL=AppKernel CODE_COVERAGE=0 allow_failures: # this currently fails because of eZPublish services.yml not quoting usage of @, despite it being tested with Sf 2.8... diff --git a/Core/Executor/ContentManager.php b/Core/Executor/ContentManager.php index 1e6f1ab2..6472ad54 100644 --- a/Core/Executor/ContentManager.php +++ b/Core/Executor/ContentManager.php @@ -320,14 +320,17 @@ protected function setReferences($content) case 'id': $value = $content->id; break; - case 'location_id': - $value = $content->contentInfo->mainLocationId; - break; case 'remote_id': case 'content_remote_id': $value = $content->contentInfo->remoteId; break; - + case 'location_id': + $value = $content->contentInfo->mainLocationId; + break; + case 'path': + $locationService = $this->repository->getLocationService(); + $value = $locationService->loadLocation($content->contentInfo->mainLocationId)->pathString; + break; default: throw new \InvalidArgumentException('Content Manager does not support setting references for attribute ' . $reference['attribute']); } diff --git a/Core/Executor/LocationManager.php b/Core/Executor/LocationManager.php index 6be9cc7a..d7951399 100644 --- a/Core/Executor/LocationManager.php +++ b/Core/Executor/LocationManager.php @@ -331,6 +331,9 @@ protected function setReferences($location) case 'location_remote_id': $value = $location->remoteId; break; + case 'path': + $value = $location->pathString; + break; default: throw new \InvalidArgumentException('Location Manager does not support setting references for attribute ' . $reference['attribute']); } diff --git a/Resources/doc/DSL/ManageContent.yml b/Resources/doc/DSL/ManageContent.yml index 0461c9f7..88d5b097 100644 --- a/Resources/doc/DSL/ManageContent.yml +++ b/Resources/doc/DSL/ManageContent.yml @@ -41,7 +41,7 @@ references: #Optional - identifier: referenceId # A string used to identify the reference - attribute: attributeId # An attribute to get the value of for the reference (supports: content_id and location_id) + attribute: attributeId # An attribute to get the value of for the reference (supports: content_id, content_remote_id, location_id, path) - type: content diff --git a/Resources/doc/DSL/ManageLocation.yml b/Resources/doc/DSL/ManageLocation.yml index 54243a55..0566fbb5 100644 --- a/Resources/doc/DSL/ManageLocation.yml +++ b/Resources/doc/DSL/ManageLocation.yml @@ -28,6 +28,11 @@ # - modified_subnode sort_field: x # Optional sort_order: ASC|DESC # Optional + # The list in references tells the manager to store specific values for later use by other steps in the current migration. + references: # Optional + - + identifier: referenceId # A string used to identify the reference + attribute: attributeId # An attribute to get the value of for the reference (supports: location_id, location_remote_id, path) - type: location mode: create diff --git a/Resources/doc/DSL/ManageRolesAndPolicies.yml b/Resources/doc/DSL/ManageRolesAndPolicies.yml index d1b28b3b..d8fc9a34 100644 --- a/Resources/doc/DSL/ManageRolesAndPolicies.yml +++ b/Resources/doc/DSL/ManageRolesAndPolicies.yml @@ -45,7 +45,7 @@ # # Subtree limitation example: # identifier: Subtree -# value: [/1/2/3/4, /1/2/3/15] # List of subtree path strings, needs to be the location id path +# value: [/1/2/3/4, /1/2/3/15] # List of subtree path strings, needs to be the location path # # UserGroup limitation example: # identifier: UserGroup diff --git a/WHATSNEW.md b/WHATSNEW.md index dcac8322..7b56ad28 100644 --- a/WHATSNEW.md +++ b/WHATSNEW.md @@ -1,6 +1,9 @@ Version 2.1.0 ============= +* New: it is now possible to set a reference to the path of a created Content/Location. + This allow to use it subsequently when assigning a role with subtree limitation + * Fix: the documentation describing usage of the 'match' keyword for updating/deleting contents and locations was incorrect