本文整理汇总了PHP中eZ\Publish\SPI\Persistence\Content\Type\Handler::loadByIdentifier方法的典型用法代码示例。如果您正苦于以下问题:PHP Handler::loadByIdentifier方法的具体用法?PHP Handler::loadByIdentifier怎么用?PHP Handler::loadByIdentifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZ\Publish\SPI\Persistence\Content\Type\Handler
的用法示例。
在下文中一共展示了Handler::loadByIdentifier方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Generate query expression for a Criterion this handler accepts.
*
* accept() must be called before calling this method.
*
* @param \eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter $converter
* @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
* @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
*
* @return \eZ\Publish\Core\Persistence\Database\Expression
*/
public function handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion)
{
$idList = array();
foreach ($criterion->value as $identifier) {
$idList[] = $this->contentTypeHandler->loadByIdentifier($identifier)->id;
}
return $query->expr->in($this->dbHandler->quoteColumn('contentclass_id', 'ezcontentobject'), $idList);
}
示例2: visitFilter
/**
* Map field value to a proper Elasticsearch filter representation.
*
* @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
* @param \eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitorDispatcher $dispatcher
* @param array $languageFilter
*
* @return mixed
*/
public function visitFilter(Criterion $criterion, Dispatcher $dispatcher, array $languageFilter)
{
if (count($criterion->value) > 1) {
$idList = array();
foreach ($criterion->value as $identifier) {
$idList[] = $this->contentTypeHandler->loadByIdentifier($identifier)->id;
}
$filter = array('terms' => array('type_id' => $idList));
} else {
$filter = array('term' => array('type_id' => $this->contentTypeHandler->loadByIdentifier($criterion->value[0])->id));
}
return $filter;
}
示例3: loadByIdentifier
/**
* Load a (defined) content type by identifier
*
* @param string $identifier
* @return \eZ\Publish\SPI\Persistence\Content\Type
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If defined type is not found
*/
public function loadByIdentifier($identifier)
{
if (isset($this->contentTypes['identifier'][$identifier])) {
return $this->contentTypes['identifier'][$identifier];
}
return $this->contentTypes['identifier'][$identifier] = $this->innerHandler->loadByIdentifier($identifier);
}
示例4: loadContentTypeByIdentifier
/**
* Get a Content Type object by identifier
*
* @throws \eZ\Publish\Core\Base\Exceptions\NotFoundException If content type with the given identifier and status DEFINED can not be found
* @throws \eZ\Publish\Core\Base\Exceptions\InvalidArgumentValue If given identifier is not a string
*
* @param string $identifier
*
* @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
*/
public function loadContentTypeByIdentifier($identifier)
{
if (!is_string($identifier)) {
throw new InvalidArgumentValue('$identifier', $identifier);
}
$spiContentType = $this->contentTypeHandler->loadByIdentifier($identifier);
return $this->buildContentTypeDomainObject($spiContentType);
}
示例5: loadContentTypeByIdentifier
/**
* Get a Content Type object by identifier.
*
* @throws \eZ\Publish\Core\Base\Exceptions\NotFoundException If content type with the given identifier and status DEFINED can not be found
* @throws \eZ\Publish\Core\Base\Exceptions\InvalidArgumentValue If given identifier is not a string
*
* @param string $identifier
*
* @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
*/
public function loadContentTypeByIdentifier($identifier)
{
if (!is_string($identifier)) {
throw new InvalidArgumentValue('$identifier', $identifier);
}
$spiContentType = $this->contentTypeHandler->loadByIdentifier($identifier);
return $this->contentTypeDomainMapper->buildContentTypeDomainObject($spiContentType, array_map(function ($id) {
return $this->contentTypeHandler->loadGroup($id);
}, $spiContentType->groupIds));
}
示例6: loadContentTypeByIdentifier
/**
* Get a Content Type object by identifier
*
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If content type with the given identifier and status DEFINED can not be found
*
* @param string $identifier
*
* @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
*/
public function loadContentTypeByIdentifier($identifier)
{
if (!is_string($identifier)) {
throw new InvalidArgumentValue('$identifier', $identifier);
}
#$solrserverconfig = Globals::getSolrServerConfig();
$solrclasses = Globals::getSolrClassesConfig();
if (array_key_exists($identifier, $solrclasses)) {
$fieldDefinitions = array();
foreach ($solrclasses[$identifier]["fields"] as $solrclassatt) {
$fieldDefinitions[] = new \eZ\Publish\Core\Repository\Values\ContentType\FieldDefinition(array("id" => $solrclassatt["id"], "identifier" => $solrclassatt["identifier"], "fieldTypeIdentifier" => $solrclassatt["fieldTypeIdentifier"], "names" => $solrclassatt["names"], "descriptions" => $solrclassatt["descriptions"], "fieldGroup" => $solrclassatt["fieldGroup"], "position" => (int) $solrclassatt["position"], "isTranslatable" => $solrclassatt["isTranslatable"], "isRequired" => $solrclassatt["isRequired"], "isInfoCollector" => $solrclassatt["isInfoCollector"], "isSearchable" => $solrclassatt["isSearchable"]));
}
$selfCreatedContentType = new ContentType(array("names" => $solrclasses[$identifier]["names"], "descriptions" => $solrclasses[$identifier]["descriptions"], "contentTypeGroups" => $solrclasses[$identifier]["contentTypeGroups"], "fieldDefinitions" => $fieldDefinitions, "id" => $solrclasses[$identifier]["id"], "status" => $solrclasses[$identifier]["status"], "identifier" => $solrclasses[$identifier]["identifier"], "creationDate" => $solrclasses[$identifier]["creationDate"], "modificationDate" => $solrclasses[$identifier]["modificationDate"], "creatorId" => $solrclasses[$identifier]["creatorId"], "modifierId" => $solrclasses[$identifier]["modifierId"], "remoteId" => $solrclasses[$identifier]["remoteId"], "urlAliasSchema" => $solrclasses[$identifier]["urlAliasSchema"], "nameSchema" => $solrclasses[$identifier]["nameSchema"], "isContainer" => $solrclasses[$identifier]["isContainer"], "mainLanguageCode" => $solrclasses[$identifier]["mainLanguageCode"], "defaultAlwaysAvailable" => $solrclasses[$identifier]["defaultAlwaysAvailable"], "defaultSortField" => $solrclasses[$identifier]["defaultSortField"], "defaultSortOrder" => $solrclasses[$identifier]["defaultSortOrder"]));
return $selfCreatedContentType;
}
$spiContentType = $this->contentTypeHandler->loadByIdentifier($identifier);
return $this->buildContentTypeDomainObject($spiContentType);
}