當前位置: 首頁>>代碼示例>>PHP>>正文


PHP LocationService::createLocation方法代碼示例

本文整理匯總了PHP中eZ\Publish\API\Repository\LocationService::createLocation方法的典型用法代碼示例。如果您正苦於以下問題:PHP LocationService::createLocation方法的具體用法?PHP LocationService::createLocation怎麽用?PHP LocationService::createLocation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在eZ\Publish\API\Repository\LocationService的用法示例。


在下文中一共展示了LocationService::createLocation方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setPostCategories

 public function setPostCategories($postId, Request $request)
 {
     $this->login($request->request->get('username'), $request->request->get('password'));
     // @todo Replace categories instead of adding
     $contentInfo = $this->contentService->loadContentInfo($postId);
     foreach ($request->request->get('categories') as $category) {
         $this->locationService->createLocation($contentInfo, $this->locationService->newLocationCreateStruct($category['categoryId']));
     }
     return new Response(true);
 }
開發者ID:bdunogier,項目名稱:wordpressapibundle,代碼行數:10,代碼來源:DefaultController.php

示例2: createLocation

 /**
  * Creates a new location for object with id $contentId.
  *
  * @param mixed $contentId
  *
  * @throws \eZ\Publish\Core\REST\Server\Exceptions\ForbiddenException
  *
  * @return \eZ\Publish\Core\REST\Server\Values\CreatedLocation
  */
 public function createLocation($contentId, Request $request)
 {
     $locationCreateStruct = $this->inputDispatcher->parse(new Message(array('Content-Type' => $request->headers->get('Content-Type')), $request->getContent()));
     $contentInfo = $this->contentService->loadContentInfo($contentId);
     try {
         $createdLocation = $this->locationService->createLocation($contentInfo, $locationCreateStruct);
     } catch (InvalidArgumentException $e) {
         throw new ForbiddenException($e->getMessage());
     }
     return new Values\CreatedLocation(array('restLocation' => new Values\RestLocation($createdLocation, 0)));
 }
開發者ID:ezsystems,項目名稱:ezpublish-kernel,代碼行數:20,代碼來源:Location.php

示例3: createLocation

 /**
  * Creates the new $location in the content repository for the given content
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed to create this location
  * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the content is already below the specified parent
  *                                        or the parent is a sub location of the location of the content
  *                                        or if set the remoteId exists already
  *
  * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
  *
  * @param \eZ\Publish\API\Repository\Values\Content\LocationCreateStruct $locationCreateStruct
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Location the newly created Location
  *
  */
 public function createLocation(ContentInfo $contentInfo, LocationCreateStruct $locationCreateStruct)
 {
     $returnValue = $this->service->createLocation($contentInfo, $locationCreateStruct);
     $this->signalDispatcher->emit(new CreateLocationSignal(array('contentId' => $contentInfo->id, 'locationId' => $returnValue->id)));
     return $returnValue;
 }
開發者ID:nlescure,項目名稱:ezpublish-kernel,代碼行數:20,代碼來源:LocationService.php


注:本文中的eZ\Publish\API\Repository\LocationService::createLocation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。