Пример #1
0
 /**
  * Swaps a location with another one.
  *
  * @param string $locationPath
  *
  * @return \eZ\Publish\Core\REST\Server\Values\NoContent
  */
 public function swapLocation($locationPath, Request $request)
 {
     $locationId = $this->extractLocationIdFromPath($locationPath);
     $location = $this->locationService->loadLocation($locationId);
     $destinationLocation = $this->locationService->loadLocation($this->extractLocationIdFromPath($this->requestParser->parseHref($request->headers->get('Destination'), 'locationPath')));
     $this->locationService->swapLocation($location, $destinationLocation);
     return new Values\NoContent();
 }
Пример #2
0
 /**
  * Swaps the contents held by $location1 and $location2
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed to swap content
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Location $location1
  * @param \eZ\Publish\API\Repository\Values\Content\Location $location2
  */
 public function swapLocation(Location $location1, Location $location2)
 {
     $returnValue = $this->service->swapLocation($location1, $location2);
     $this->signalDispatcher->emit(new SwapLocationSignal(array('location1Id' => $location1->id, 'content1Id' => $location1->contentId, 'location2Id' => $location2->id, 'content2Id' => $location2->contentId)));
     return $returnValue;
 }