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


PHP Handler::load方法代码示例

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


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

示例1: mapFields

 public function mapFields(Content $content, $languageCode)
 {
     $fields = [];
     $contentType = $this->contentTypeHandler->load($content->versionInfo->contentInfo->contentTypeId);
     foreach ($content->fields as $field) {
         if ($field->languageCode !== $languageCode) {
             continue;
         }
         foreach ($contentType->fieldDefinitions as $fieldDefinition) {
             if ($fieldDefinition->id !== $field->fieldDefinitionId) {
                 continue;
             }
             $fieldType = $this->fieldRegistry->getType($field->type);
             $indexFields = $fieldType->getIndexData($field, $fieldDefinition);
             foreach ($indexFields as $indexField) {
                 if ($indexField->value === null) {
                     continue;
                 }
                 $documentField = new Field($name = $this->fieldNameGenerator->getName($indexField->name, $fieldDefinition->identifier, $contentType->identifier), $indexField->value, $indexField->type);
                 $this->appendField($fields, $fieldDefinition, $documentField);
             }
         }
     }
     return $fields;
 }
开发者ID:ezsystems,项目名称:ezplatform-solr-search-engine,代码行数:25,代码来源:BlockDocumentsContentFields.php

示例2: mapFields

 public function mapFields(Content $content)
 {
     $versionInfo = $content->versionInfo;
     $contentInfo = $content->versionInfo->contentInfo;
     // UserGroups and Users are Content, but permissions cascade is achieved through
     // Locations hierarchy. We index all ancestor Location Content ids of all
     // Locations of an owner.
     $ancestorLocationsContentIds = $this->getAncestorLocationsContentIds($contentInfo->ownerId);
     // Add owner user id as it can also be considered as user group.
     $ancestorLocationsContentIds[] = $contentInfo->ownerId;
     $section = $this->sectionHandler->load($contentInfo->sectionId);
     return [new Field('content_id', $contentInfo->id, new FieldType\IdentifierField()), new Field('content_type_id', $contentInfo->contentTypeId, new FieldType\IdentifierField()), new Field('content_version_no', $versionInfo->versionNo, new FieldType\IntegerField()), new Field('content_version_status', $versionInfo->status, new FieldType\IdentifierField()), new Field('content_name', $contentInfo->name, new FieldType\StringField()), new Field('content_version_creator_user_id', $versionInfo->creatorId, new FieldType\IdentifierField()), new Field('content_owner_user_id', $contentInfo->ownerId, new FieldType\IdentifierField()), new Field('content_section_id', $contentInfo->sectionId, new FieldType\IdentifierField()), new Field('content_remote_id', $contentInfo->remoteId, new FieldType\IdentifierField()), new Field('content_modification_date', $contentInfo->modificationDate, new FieldType\DateField()), new Field('content_publication_date', $contentInfo->publicationDate, new FieldType\DateField()), new Field('content_language_codes', array_keys($versionInfo->names), new FieldType\MultipleStringField()), new Field('content_main_language_code', $contentInfo->mainLanguageCode, new FieldType\StringField()), new Field('content_always_available', $contentInfo->alwaysAvailable, new FieldType\BooleanField()), new Field('content_owner_user_group_ids', $ancestorLocationsContentIds, new FieldType\MultipleIdentifierField()), new Field('content_section_identifier', $section->identifier, new FieldType\IdentifierField()), new Field('content_section_name', $section->name, new FieldType\StringField()), new Field('content_type_group_ids', $this->contentTypeHandler->load($contentInfo->contentTypeId)->groupIds, new FieldType\MultipleIdentifierField()), new Field('content_object_state_ids', $this->getObjectStateIds($contentInfo->id), new FieldType\MultipleIdentifierField())];
 }
开发者ID:ezsystems,项目名称:ezplatform-solr-search-engine,代码行数:13,代码来源:BlockDocumentsBaseContentFields.php

示例3: load

 /**
  * @param int $contentTypeId
  * @param int $status
  * @return \eZ\Publish\SPI\Persistence\Content\Type
  */
 public function load($contentTypeId, $status = Type::STATUS_DEFINED)
 {
     if (isset($this->contentTypes['id'][$contentTypeId][$status])) {
         return $this->contentTypes['id'][$contentTypeId][$status];
     }
     return $this->contentTypes['id'][$contentTypeId][$status] = $this->innerHandler->load($contentTypeId, $status);
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:12,代码来源:MemoryCachingHandler.php

示例4: copy

 /**
  * Copy Content with Fields and Versions from $contentId in $version.
  *
  * Copies all fields from $contentId in $versionNo (or all versions if null)
  * to a new object which is returned. Version numbers are maintained.
  *
  * @todo Should relations be copied? Which ones?
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If content or version is not found
  *
  * @param mixed $contentId
  * @param mixed|null $versionNo Copy all versions if left null
  *
  * @return \eZ\Publish\SPI\Persistence\Content
  */
 public function copy($contentId, $versionNo = null)
 {
     $currentVersionNo = isset($versionNo) ? $versionNo : $this->loadContentInfo($contentId)->currentVersionNo;
     // Copy content in given version or current version
     $createStruct = $this->mapper->createCreateStructFromContent($this->load($contentId, $currentVersionNo));
     $content = $this->internalCreate($createStruct, $currentVersionNo);
     $contentType = $this->contentTypeHandler->load($createStruct->typeId);
     // If version was not passed also copy other versions
     if (!isset($versionNo)) {
         foreach ($this->listVersions($contentId) as $versionInfo) {
             if ($versionInfo->versionNo === $currentVersionNo) {
                 continue;
             }
             $versionContent = $this->load($contentId, $versionInfo->versionNo);
             $versionContent->versionInfo->contentInfo->id = $content->versionInfo->contentInfo->id;
             $versionContent->versionInfo->modificationDate = $createStruct->modified;
             $versionContent->versionInfo->creationDate = $createStruct->modified;
             $versionContent->versionInfo->id = $this->contentGateway->insertVersion($versionContent->versionInfo, $versionContent->fields);
             $this->fieldHandler->createNewFields($versionContent, $contentType);
             // Create names
             foreach ($versionContent->versionInfo->names as $language => $name) {
                 $this->contentGateway->setName($content->versionInfo->contentInfo->id, $versionInfo->versionNo, $name, $language);
             }
         }
     }
     return $content;
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:42,代码来源:Handler.php

示例5: mapLocationFields

 protected function mapLocationFields(Location $location, Content $content, Section $section)
 {
     $fields = array(new Field('location', $location->id, new FieldType\IdentifierField()), new Field('document_type', self::DOCUMENT_TYPE_IDENTIFIER_LOCATION, new FieldType\IdentifierField()), new Field('priority', $location->priority, new FieldType\IntegerField()), new Field('hidden', $location->hidden, new FieldType\BooleanField()), new Field('invisible', $location->invisible, new FieldType\BooleanField()), new Field('remote_id', $location->remoteId, new FieldType\IdentifierField()), new Field('parent_id', $location->parentId, new FieldType\IdentifierField()), new Field('path_string', $location->pathString, new FieldType\IdentifierField()), new Field('depth', $location->depth, new FieldType\IntegerField()), new Field('sort_field', $location->sortField, new FieldType\IdentifierField()), new Field('sort_order', $location->sortOrder, new FieldType\IdentifierField()), new Field('is_main_location', $location->id == $content->versionInfo->contentInfo->mainLocationId, new FieldType\BooleanField()));
     // UserGroups and Users are Content, but permissions cascade is achieved through
     // Locations hierarchy. We index all ancestor Location Content ids of all
     // Locations of an owner.
     $ancestorLocationsContentIds = $this->getAncestorLocationsContentIds($content->versionInfo->contentInfo->ownerId);
     // Add owner user id as it can also be considered as user group.
     $ancestorLocationsContentIds[] = $content->versionInfo->contentInfo->ownerId;
     $fields[] = new Field('content_owner_user_group', $ancestorLocationsContentIds, new FieldType\MultipleIdentifierField());
     $fields[] = new Field('content_id', $content->versionInfo->contentInfo->id, new FieldType\IdentifierField());
     $fields[] = new Field('content_type', $content->versionInfo->contentInfo->contentTypeId, new FieldType\IdentifierField());
     $fields[] = new Field('content_version_no', $content->versionInfo->versionNo, new FieldType\IntegerField());
     $fields[] = new Field('content_status', $content->versionInfo->status, new FieldType\IdentifierField());
     $fields[] = new Field('content_name', $content->versionInfo->contentInfo->name, new FieldType\StringField());
     $fields[] = new Field('content_creator', $content->versionInfo->creatorId, new FieldType\IdentifierField());
     $fields[] = new Field('content_owner', $content->versionInfo->contentInfo->ownerId, new FieldType\IdentifierField());
     $fields[] = new Field('content_section', $content->versionInfo->contentInfo->sectionId, new FieldType\IdentifierField());
     $fields[] = new Field('content_section_identifier', $section->identifier, new FieldType\IdentifierField());
     $fields[] = new Field('content_section_name', $section->name, new FieldType\StringField());
     $fields[] = new Field('content_remote_id', $content->versionInfo->contentInfo->remoteId, new FieldType\IdentifierField());
     $fields[] = new Field('content_modified', $content->versionInfo->contentInfo->modificationDate, new FieldType\DateField());
     $fields[] = new Field('content_published', $content->versionInfo->contentInfo->publicationDate, new FieldType\DateField());
     $fields[] = new Field('language_code', array_keys($content->versionInfo->names), new FieldType\MultipleStringField());
     $fields[] = new Field('content_always_available', $content->versionInfo->contentInfo->alwaysAvailable, new FieldType\BooleanField());
     $fields[] = new Field('content_group', $this->contentTypeHandler->load($content->versionInfo->contentInfo->contentTypeId)->groupIds, new FieldType\MultipleIdentifierField());
     $fields[] = new Field('content_object_state', $this->getObjectStateIds($content->versionInfo->contentInfo->id), new FieldType\MultipleIdentifierField());
     return $fields;
 }
开发者ID:joaoinacio,项目名称:ezplatform-solr-search-engine,代码行数:29,代码来源:NativeDocumentMapper.php

示例6: mapContent

 /**
  * Map content to document.
  *
  * A document is an array of fields
  *
  * @param \eZ\Publish\SPI\Persistence\Content $content
  *
  * @return array
  */
 protected function mapContent(Content $content)
 {
     $locations = $this->locationHandler->loadLocationsByContent($content->versionInfo->contentInfo->id);
     $mainLocation = null;
     foreach ($locations as $location) {
         if ($location->id == $content->versionInfo->contentInfo->mainLocationId) {
             $mainLocation = $location;
         }
     }
     $section = $this->sectionHandler->load($content->versionInfo->contentInfo->sectionId);
     // UserGroups and Users are Content, but permissions cascade is achieved through
     // Locations hierarchy. We index all ancestor Location Content ids of all
     // Locations of an owner.
     $ancestorLocationsContentIds = $this->getAncestorLocationsContentIds($content->versionInfo->contentInfo->ownerId);
     // Add owner user id as it can also be considered as user group.
     $ancestorLocationsContentIds[] = $content->versionInfo->contentInfo->ownerId;
     $document = array(new Field('id', $content->versionInfo->contentInfo->id, new FieldType\IdentifierField()), new Field('type', $content->versionInfo->contentInfo->contentTypeId, new FieldType\IdentifierField()), new Field('version', $content->versionInfo->versionNo, new FieldType\IdentifierField()), new Field('status', $content->versionInfo->status, new FieldType\IdentifierField()), new Field('name', $content->versionInfo->contentInfo->name, new FieldType\StringField()), new Field('creator', $content->versionInfo->creatorId, new FieldType\IdentifierField()), new Field('owner', $content->versionInfo->contentInfo->ownerId, new FieldType\IdentifierField()), new Field('owner_user_group', $ancestorLocationsContentIds, new FieldType\MultipleIdentifierField()), new Field('section', $content->versionInfo->contentInfo->sectionId, new FieldType\IdentifierField()), new Field('section_identifier', $section->identifier, new FieldType\IdentifierField()), new Field('section_name', $section->name, new FieldType\StringField()), new Field('remote_id', $content->versionInfo->contentInfo->remoteId, new FieldType\IdentifierField()), new Field('modified', $content->versionInfo->contentInfo->modificationDate, new FieldType\DateField()), new Field('published', $content->versionInfo->contentInfo->publicationDate, new FieldType\DateField()), new Field('path', array_map(function ($location) {
         return $location->pathString;
     }, $locations), new FieldType\MultipleIdentifierField()), new Field('location', array_map(function ($location) {
         return $location->id;
     }, $locations), new FieldType\MultipleIdentifierField()), new Field('depth', array_map(function ($location) {
         return $location->depth;
     }, $locations), new FieldType\IntegerField()), new Field('priority', array_map(function ($location) {
         return $location->priority;
     }, $locations), new FieldType\IntegerField()), new Field('location_parent', array_map(function ($location) {
         return $location->parentId;
     }, $locations), new FieldType\MultipleIdentifierField()), new Field('location_remote_id', array_map(function ($location) {
         return $location->remoteId;
     }, $locations), new FieldType\MultipleIdentifierField()), new Field('language_code', array_keys($content->versionInfo->names), new FieldType\MultipleStringField()), new Field('main_language_code', $content->versionInfo->contentInfo->mainLanguageCode, new FieldType\StringField()), new Field('invisible', array_map(function ($location) {
         return $location->invisible;
     }, $locations), new FieldType\MultipleBooleanField()), new Field('always_available', $content->versionInfo->contentInfo->alwaysAvailable, new FieldType\BooleanField()));
     if ($mainLocation !== null) {
         $document[] = new Field('main_location', $mainLocation->id, new FieldType\IdentifierField());
         $document[] = new Field('main_location_parent', $mainLocation->parentId, new FieldType\IdentifierField());
         $document[] = new Field('main_location_remote_id', $mainLocation->remoteId, new FieldType\IdentifierField());
         $document[] = new Field('main_path', $mainLocation->pathString, new FieldType\IdentifierField());
         $document[] = new Field('main_depth', $mainLocation->depth, new FieldType\IntegerField());
         $document[] = new Field('main_priority', $mainLocation->priority, new FieldType\IntegerField());
     }
     $contentType = $this->contentTypeHandler->load($content->versionInfo->contentInfo->contentTypeId);
     $document[] = new Field('group', $contentType->groupIds, new FieldType\MultipleIdentifierField());
     foreach ($content->fields as $field) {
         foreach ($contentType->fieldDefinitions as $fieldDefinition) {
             if ($fieldDefinition->id !== $field->fieldDefinitionId) {
                 continue;
             }
             $fieldType = $this->fieldRegistry->getType($field->type);
             foreach ($fieldType->getIndexData($field) as $indexField) {
                 $document[] = new Field($this->fieldNameGenerator->getName($indexField->name, $fieldDefinition->identifier, $contentType->identifier), $indexField->value, $indexField->type);
             }
         }
     }
     $objectStateIds = array();
     foreach ($this->objectStateHandler->loadAllGroups() as $objectStateGroup) {
         $objectStateIds[] = $this->objectStateHandler->getContentState($content->versionInfo->contentInfo->id, $objectStateGroup->id)->id;
     }
     $document[] = new Field('object_state', $objectStateIds, new FieldType\MultipleIdentifierField());
     return $document;
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:68,代码来源:Handler.php

示例7: resolveNameSchema

 /**
  * Convenience method for resolving name schema.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Content $content
  * @param array $fieldMap
  * @param array $languageCodes
  * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType|null $contentType
  *
  * @return array
  */
 public function resolveNameSchema(Content $content, array $fieldMap = array(), array $languageCodes = array(), ContentType $contentType = null)
 {
     if ($contentType === null) {
         $contentType = $this->contentTypeHandler->load($content->contentInfo->contentTypeId);
     }
     $languageCodes = $languageCodes ?: $content->versionInfo->languageCodes;
     return $this->resolve($contentType->nameSchema, $contentType, $this->mergeFieldMap($content, $fieldMap, $languageCodes), $languageCodes);
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:18,代码来源:NameSchemaService.php

示例8: buildRelationDomainObject

 /**
  * Builds API Relation object from provided SPI Relation object.
  *
  * @param \eZ\Publish\SPI\Persistence\Content\Relation $spiRelation
  * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $sourceContentInfo
  * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $destinationContentInfo
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Relation
  */
 public function buildRelationDomainObject(SPIRelation $spiRelation, ContentInfo $sourceContentInfo, ContentInfo $destinationContentInfo)
 {
     $sourceFieldDefinitionIdentifier = null;
     if ($spiRelation->sourceFieldDefinitionId !== null) {
         $contentType = $this->contentTypeHandler->load($sourceContentInfo->contentTypeId);
         foreach ($contentType->fieldDefinitions as $fieldDefinition) {
             if ($fieldDefinition->id !== $spiRelation->sourceFieldDefinitionId) {
                 continue;
             }
             $sourceFieldDefinitionIdentifier = $fieldDefinition->identifier;
             break;
         }
     }
     return new Relation(array('id' => $spiRelation->id, 'sourceFieldDefinitionIdentifier' => $sourceFieldDefinitionIdentifier, 'type' => $spiRelation->type, 'sourceContentInfo' => $sourceContentInfo, 'destinationContentInfo' => $destinationContentInfo));
 }
开发者ID:xcorp1986,项目名称:ezpublish-kernel,代码行数:24,代码来源:DomainMapper.php

示例9: mapLocation

 public function mapLocation(Location $location)
 {
     $contentInfo = $this->contentHandler->loadContentInfo($location->contentId);
     $content = $this->contentHandler->load($location->contentId, $contentInfo->currentVersionNo);
     $section = $this->sectionHandler->load($content->versionInfo->contentInfo->sectionId);
     $fields = array(new Field('location', $location->id, new FieldType\IdentifierField()), new Field('document_type', 'location', new FieldType\IdentifierField()), new Field('priority', $location->priority, new FieldType\IntegerField()), new Field('hidden', $location->hidden, new FieldType\BooleanField()), new Field('invisible', $location->invisible, new FieldType\BooleanField()), new Field('remote_id', $location->remoteId, new FieldType\IdentifierField()), new Field('parent_id', $location->parentId, new FieldType\IdentifierField()), new Field('path_string', $location->pathString, new FieldType\IdentifierField()), new Field('depth', $location->depth, new FieldType\IntegerField()), new Field('sort_field', $location->sortField, new FieldType\IdentifierField()), new Field('sort_order', $location->sortOrder, new FieldType\IdentifierField()), new Field('is_main_location', $location->id == $content->versionInfo->contentInfo->mainLocationId, new FieldType\BooleanField()));
     // UserGroups and Users are Content, but permissions cascade is achieved through
     // Locations hierarchy. We index all ancestor Location Content ids of all
     // Locations of an owner.
     $ancestorLocationsContentIds = $this->getAncestorLocationsContentIds($contentInfo->ownerId);
     // Add owner user id as it can also be considered as user group.
     $ancestorLocationsContentIds[] = $contentInfo->ownerId;
     $fields[] = new Field('content_owner_user_group', $ancestorLocationsContentIds, new FieldType\MultipleIdentifierField());
     $fields[] = new Field('content_id', $content->versionInfo->contentInfo->id, new FieldType\IdentifierField());
     $fields[] = new Field('content_type', $content->versionInfo->contentInfo->contentTypeId, new FieldType\IdentifierField());
     $fields[] = new Field('content_version', $content->versionInfo->versionNo, new FieldType\IdentifierField());
     $fields[] = new Field('content_status', $content->versionInfo->status, new FieldType\IdentifierField());
     $fields[] = new Field('content_name', $content->versionInfo->contentInfo->name, new FieldType\StringField());
     $fields[] = new Field('content_creator', $content->versionInfo->creatorId, new FieldType\IdentifierField());
     $fields[] = new Field('content_owner', $content->versionInfo->contentInfo->ownerId, new FieldType\IdentifierField());
     $fields[] = new Field('content_section', $content->versionInfo->contentInfo->sectionId, new FieldType\IdentifierField());
     $fields[] = new Field('content_section_identifier', $section->identifier, new FieldType\IdentifierField());
     $fields[] = new Field('content_section_name', $section->name, new FieldType\StringField());
     $fields[] = new Field('content_remote_id', $content->versionInfo->contentInfo->remoteId, new FieldType\IdentifierField());
     $fields[] = new Field('content_modified', $content->versionInfo->contentInfo->modificationDate, new FieldType\DateField());
     $fields[] = new Field('content_published', $content->versionInfo->contentInfo->publicationDate, new FieldType\DateField());
     $fields[] = new Field('language_code', array_keys($content->versionInfo->names), new FieldType\MultipleStringField());
     $fields[] = new Field('content_always_available', $content->versionInfo->contentInfo->alwaysAvailable, new FieldType\BooleanField());
     $fields[] = new Field('content_group', $this->contentTypeHandler->load($content->versionInfo->contentInfo->contentTypeId)->groupIds, new FieldType\MultipleIdentifierField());
     $fields[] = new Field('content_object_state', $this->getObjectStateIds($content->versionInfo->contentInfo->id), new FieldType\MultipleIdentifierField());
     $contentType = $this->contentTypeHandler->load($content->versionInfo->contentInfo->contentTypeId);
     $fieldSets = $this->mapContentFields($content, $contentType, false);
     $documents = array();
     foreach ($fieldSets as $languageCode => $translationFields) {
         $translationFields[] = new Field('meta_indexed_language_code', $languageCode, new FieldType\StringField());
         $translationFields[] = new Field('meta_indexed_is_main_translation', $languageCode === $content->versionInfo->contentInfo->mainLanguageCode, new FieldType\BooleanField());
         $translationFields[] = new Field('meta_indexed_is_main_translation_and_always_available', $languageCode === $content->versionInfo->contentInfo->mainLanguageCode && $content->versionInfo->contentInfo->alwaysAvailable, new FieldType\BooleanField());
         $isMainTranslation = $content->versionInfo->contentInfo->mainLanguageCode === $languageCode;
         $alwaysAvailable = $isMainTranslation && $content->versionInfo->contentInfo->alwaysAvailable;
         $documents[] = new Document(array("id" => $this->generateLocationDocumentId($location, $languageCode), "languageCode" => $languageCode, "alwaysAvailable" => $alwaysAvailable, "isMainTranslation" => $isMainTranslation, "fields" => array_merge($fields, $translationFields)));
     }
     return $documents;
 }
开发者ID:nlescure,项目名称:ezpublish-kernel,代码行数:43,代码来源:NativeDocumentMapper.php

示例10: 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( APIContentType $contentType, APIContentTypeGroup $contentTypeGroup )
    {
        if ( $this->repository->hasAccess( 'class', 'update' ) !== true )
            throw new UnauthorizedException( 'ContentType', 'update' );

        $spiContentType = $this->contentTypeHandler->load(
            $contentType->id,
            $contentType->status
        );

        if ( !in_array( $contentTypeGroup->id, $spiContentType->groupIds ) )
        {
            throw new InvalidArgumentException(
                "\$contentTypeGroup",
                "The given ContentType is not assigned the ContentTypeGroup"
            );
        }

        $this->repository->beginTransaction();
        try
        {
            $this->contentTypeHandler->unlink(
                $contentTypeGroup->id,
                $contentType->id,
                $contentType->status
            );
            $this->repository->commit();
        }
        catch ( APIBadStateException $e )
        {
            $this->repository->rollback();
            throw new BadStateException(
                "\$contentType",
                "The given ContentTypeGroup is the last group assigned to the ContentType",
                $e
            );
        }
        catch ( Exception $e )
        {
            $this->repository->rollback();
            throw $e;
        }
    }
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:53,代码来源:ContentTypeService.php

示例11: mapLocation

 /**
  * Maps given Location to a Document.
  *
  * Returned Document represents a "parent" Location document searchable with Location Search.
  *
  * @param \eZ\Publish\SPI\Persistence\Content\Location $location
  *
  * @return \eZ\Publish\Core\Search\Elasticsearch\Content\Document
  */
 public function mapLocation(Location $location)
 {
     $contentInfo = $this->contentHandler->loadContentInfo($location->contentId);
     $content = $this->contentHandler->load($location->contentId, $contentInfo->currentVersionNo);
     $section = $this->sectionHandler->load($content->versionInfo->contentInfo->sectionId);
     $document = $this->mapContentLocation($location, $content);
     $document->id = $location->id;
     $document->type = "location";
     $document->fields[] = new Field('is_main_location', $location->id == $content->versionInfo->contentInfo->mainLocationId, new FieldType\BooleanField());
     // UserGroups and Users are Content, but permissions cascade is achieved through
     // Locations hierarchy. We index all ancestor Location Content ids of all
     // Locations of an owner.
     $ancestorLocationsContentIds = $this->getAncestorLocationsContentIds($contentInfo->ownerId);
     // Add owner user id as it can also be considered as user group.
     $ancestorLocationsContentIds[] = $contentInfo->ownerId;
     $document->fields[] = new Field('content_owner_user_group', $ancestorLocationsContentIds, new FieldType\MultipleIdentifierField());
     $document->fields[] = new Field('content_id', $content->versionInfo->contentInfo->id, new FieldType\IdentifierField());
     $document->fields[] = new Field('content_type', $content->versionInfo->contentInfo->contentTypeId, new FieldType\IdentifierField());
     $document->fields[] = new Field('content_version', $content->versionInfo->versionNo, new FieldType\IdentifierField());
     $document->fields[] = new Field('content_status', $content->versionInfo->status, new FieldType\IdentifierField());
     $document->fields[] = new Field('content_name', $content->versionInfo->contentInfo->name, new FieldType\StringField());
     $document->fields[] = new Field('content_creator', $content->versionInfo->creatorId, new FieldType\IdentifierField());
     $document->fields[] = new Field('content_owner', $content->versionInfo->contentInfo->ownerId, new FieldType\IdentifierField());
     $document->fields[] = new Field('content_section', $content->versionInfo->contentInfo->sectionId, new FieldType\IdentifierField());
     $document->fields[] = new Field('content_section_identifier', $section->identifier, new FieldType\IdentifierField());
     $document->fields[] = new Field('content_section_name', $section->name, new FieldType\StringField());
     $document->fields[] = new Field('content_remote_id', $content->versionInfo->contentInfo->remoteId, new FieldType\IdentifierField());
     $document->fields[] = new Field('content_modified', $content->versionInfo->contentInfo->modificationDate, new FieldType\DateField());
     $document->fields[] = new Field('content_published', $content->versionInfo->contentInfo->publicationDate, new FieldType\DateField());
     $document->fields[] = new Field('content_language_code', array_keys($content->versionInfo->names), new FieldType\MultipleStringField());
     $document->fields[] = new Field('content_always_available', $content->versionInfo->contentInfo->alwaysAvailable, new FieldType\BooleanField());
     $contentType = $this->contentTypeHandler->load($content->versionInfo->contentInfo->contentTypeId);
     $document->fields[] = new Field('content_group', $contentType->groupIds, new FieldType\MultipleIdentifierField());
     $document->fields[] = new Field('content_object_state', $this->getObjectStateIds($content->versionInfo->contentInfo->id), new FieldType\MultipleIdentifierField());
     return $document;
 }
开发者ID:nlescure,项目名称:ezpublish-kernel,代码行数:45,代码来源:StandardMapper.php


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