Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-27748

API: Copy a single Location

    XMLWordPrintable

Details

    Description

      As a eZ Platform Developer, I would like to be able to create a copy of a Location (not the whole subtree) in a single API call.

      $newlocation = $locationService->copyLocation($location, $parentLocation);
      

      at the moment to do that, you need to use the ContentService. And it takes quite a lot of line to write and also a lot of Mocks to test

      $locationCreateStruct = $this->locationService->newLocationCreateStruct(
              $newParentLocationId
          );
      
      $copiedContent = $this->contentService->copyContent(
             $currentLocation->contentInfo,
             $locationCreateStruct
          );
      
      $newLocation = $this->locationService->loadLocation(
              $copiedContent->contentInfo->mainLocationId
          );
      

      To see a real life usage (with Phpspec tests): https://github.com/ezsystems/hybrid-platform-ui/pull/98

      Attachments

        Activity

          People

            Unassigned Unassigned
            yannick.roger-obsolete@ez.no Yannick Roger (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: