当前位置: 首页>>代码示例>>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;未经允许,请勿转载。