当前位置: 首页>>代码示例>>PHP>>正文


PHP Visitor::getMediaType方法代码示例

本文整理汇总了PHP中eZ\Publish\Core\REST\Common\Output\Visitor::getMediaType方法的典型用法代码示例。如果您正苦于以下问题:PHP Visitor::getMediaType方法的具体用法?PHP Visitor::getMediaType怎么用?PHP Visitor::getMediaType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZ\Publish\Core\REST\Common\Output\Visitor的用法示例。


在下文中一共展示了Visitor::getMediaType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteSection

 /**
  * Deletes $section from content repository.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If the specified section is not found
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed to delete a section
  * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException  if section can not be deleted
  *         because it is still assigned to some contents.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Section $section
  */
 public function deleteSection(Section $section)
 {
     $response = $this->client->request('DELETE', $section->id, new Message(array('Accept' => $this->outputVisitor->getMediaType('Section'))));
     if (!empty($response->body)) {
         $this->inputDispatcher->parse($response);
     }
 }
开发者ID:Heyfara,项目名称:ezpublish-kernel,代码行数:17,代码来源:SectionService.php

示例2: findTrashItems

 /**
  * Returns a collection of Trashed locations contained in the trash.
  *
  * $query allows to filter/sort the elements to be contained in the collection.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Query $query
  *
  * @return \eZ\Publish\API\Repository\Values\Content\SearchResult
  */
 public function findTrashItems(Query $query)
 {
     $response = $this->client->request('GET', $this->requestParser->generate('trashItems'), new Message(array('Accept' => $this->outputVisitor->getMediaType('LocationList'))));
     $locations = $this->inputDispatcher->parse($response);
     $trashItems = array();
     foreach ($locations as $location) {
         $trashItems[] = $this->buildTrashItem($location);
     }
     return $trashItems;
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:19,代码来源:TrashService.php

示例3: getRoleAssignmentsForUserGroup

 /**
  * Returns the roles assigned to the given user group.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read a user group
  *
  * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup
  *
  * @return \eZ\Publish\API\Repository\Values\User\UserGroupRoleAssignment[]
  */
 public function getRoleAssignmentsForUserGroup(UserGroup $userGroup)
 {
     $response = $this->client->request('GET', $this->requestParser->generate('groupRoleAssignments'), new Message(array('Accept' => $this->outputVisitor->getMediaType('RoleAssignmentList'))));
     $roleAssignments = $this->inputDispatcher->parse($response);
     $userGroupRoleAssignments = array();
     foreach ($roleAssignments as $roleAssignment) {
         $userGroupRoleAssignments[] = new UserGroupRoleAssignment(array('limitation' => $roleAssignment->getRoleLimitation(), 'role' => $roleAssignment->getRole(), 'userGroup' => $userGroup));
     }
     return $userGroupRoleAssignments;
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:19,代码来源:RoleService.php

示例4: getContentState

 /**
  * Gets the object-state of object identified by $contentId.
  *
  * The $state is the id of the state within one group.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
  * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup
  *
  * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectState
  */
 public function getContentState(ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup)
 {
     $values = $this->requestParser->parse('object', $contentInfo->id);
     $groupValues = $this->requestParser->parse('objectstategroup', $objectStateGroup->id);
     $response = $this->client->request('GET', $this->requestParser->generate('objectObjectStates', array('object' => $values['object'])), new Message(array('Accept' => $this->outputVisitor->getMediaType('ContentObjectStates'))));
     $objectStates = $this->inputDispatcher->parse($response);
     foreach ($objectStates as $state) {
         $stateValues = $this->requestParser->parse('objectstate', $state->id);
         if ($stateValues['objectstategroup'] == $groupValues['objectstategroup']) {
             return $state;
         }
     }
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:23,代码来源:ObjectStateService.php

示例5: loadContent

 /**
  * Loads content in a version of the given content object.
  *
  * If no version number is given, the method returns the current version
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the content or version with the given id does not exist
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version
  *
  * @param int $contentId
  * @param array $languages A language filter for fields. If not given all languages are returned
  * @param int $versionNo the version number. If not given the current version is returned
  * @param bool $useAlwaysAvailable Add Main language to \$languages if true (default) and if alwaysAvailable is true
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Content
  * @todo Handle $versionNo = null
  * @todo Handle language filters
  */
 public function loadContent($contentId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true)
 {
     // $contentId should already be a URL!
     $contentIdValues = $this->requestParser->parse('object', $contentId);
     $url = '';
     if ($versionNo === null) {
         $url = $this->fetchCurrentVersionUrl($this->requestParser->generate('objectCurrentVersion', array('object' => $contentIdValues['object'])));
     } else {
         $url = $this->requestParser->generate('objectVersion', array('object' => $contentIdValues['object'], 'version' => $versionNo));
     }
     $response = $this->client->request('GET', $url, new Message(array('Accept' => $this->outputVisitor->getMediaType('Version'))));
     return $this->inputDispatcher->parse($response);
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:30,代码来源:ContentService.php

示例6: unassignContentTypeGroup

 /**
  * Unassign a content type from a group.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to link a content type
  * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If the content type is not assigned this the given group.
  * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException If $contentTypeGroup is the last group assigned to the content type
  *
  * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType
  * @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup
  */
 public function unassignContentTypeGroup(ContentType $contentType, ContentTypeGroup $contentTypeGroup)
 {
     if ($contentType instanceof ContentTypeDraft) {
         $urlValues = $this->requestParser->parse("typeDraft", $contentType->id);
     } else {
         $urlValues = $this->requestParser->parse("type", $contentType->id);
     }
     $groupUrlValues = $this->requestParser->parse("typegroup", $contentTypeGroup->id);
     $urlValues["group"] = $groupUrlValues["typegroup"];
     $response = $this->client->request('DELETE', $this->requestParser->generate('groupOfType', $urlValues), new Message(array('Accept' => $this->outputVisitor->getMediaType('ContentTypeGroupRefList'))));
     if ($this->isErrorResponse($response)) {
         try {
             $this->inputDispatcher->parse($response);
         } catch (ForbiddenException $e) {
             throw new InvalidArgumentException($e->getMessage(), $e->getCode());
         } catch (NotFoundException $e) {
             throw new BadStateException($e->getMessage(), $e->getCode());
         }
     }
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:30,代码来源:ContentTypeService.php

示例7: loadLocationChildren

 /**
  * Loads children which are readable by the current user of a location object sorted by sortField and sortOrder
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Location $location
  *
  * @param int $offset the start offset for paging
  * @param int $limit the number of locations returned. If $limit = -1 all children starting at $offset are returned
  *
  * @return \eZ\Publish\API\Repository\Values\Content\LocationList
  */
 public function loadLocationChildren(Location $location, $offset = 0, $limit = -1)
 {
     $values = $this->requestParser->parse('location', $location->id);
     $response = $this->client->request('GET', $this->requestParser->generate('locationChildren', array('location' => $values['location'])), new Message(array('Accept' => $this->outputVisitor->getMediaType('LocationList'))));
     return $this->inputDispatcher->parse($response);
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:16,代码来源:LocationService.php


注:本文中的eZ\Publish\Core\REST\Common\Output\Visitor::getMediaType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。