/** * Returns the field map if given $sortClauses contain a Field sort clause. * * Otherwise an empty array is returned. * * @param null|\eZ\Publish\API\Repository\Values\Content\Query\SortClause[] $sortClauses * * @return array */ protected function getFieldMap($sortClauses) { foreach ((array) $sortClauses as $sortClause) { if ($sortClause instanceof Field || $sortClause instanceof MapLocationDistance) { return $this->contentTypeGateway->getFieldMap(); } } return array(); }
/** * @see \eZ\Publish\SPI\Persistence\Content\Type\Handler::getSearchableFieldMap */ public function getSearchableFieldMap() { $fieldMap = []; $rows = $this->contentTypeGateway->getSearchableFieldMapData(); foreach ($rows as $row) { $fieldMap[$row['content_type_identifier']][$row['field_definition_identifier']] = ['field_type_identifier' => $row['field_type_identifier'], 'field_definition_id' => $row['field_definition_id']]; } return $fieldMap; }
/** * Returns searchable field mapping data. * * @return array */ public function getSearchableFieldMapData() { try { return $this->innerGateway->getSearchableFieldMapData(); } catch (DBALException $e) { throw new RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new RuntimeException('Database error', 0, $e); } }
/** * Publishes the Type with $typeId from $sourceVersion to $targetVersion, * including its fields * * @param int $typeId * @param int $sourceStatus * @param int $targetStatus * * @return void */ public function publishTypeAndFields($typeId, $sourceStatus, $targetStatus) { try { return $this->innerGateway->publishTypeAndFields($typeId, $sourceStatus, $targetStatus); } catch (DBALException $e) { throw new RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new RuntimeException('Database error', 0, $e); } }
/** * Publishes $toType to $newStatus. * * @param \eZ\Publish\SPI\Persistence\Content\Type $toType * @param int $newStatus */ public function publishNewType(Type $toType, $newStatus) { $this->contentTypeGateway->publishTypeAndFields($toType->id, $toType->status, Type::STATUS_MODIFIED); $script = \eZScheduledScript::create('syncobjectattributes.php', \eZINI::instance('ezscriptmonitor.ini')->variable('GeneralSettings', 'PhpCliCommand') . ' extension/ezscriptmonitor/bin/' . \eZScheduledScript::SCRIPT_NAME_STRING . ' -s ' . \eZScheduledScript::SITE_ACCESS_STRING . ' --classid=' . $toType->id); $script->store(); }
/** * Publishes $toType to $newStatus * * @param \eZ\Publish\SPI\Persistence\Content\Type $toType * @param int $newStatus * * @return void */ public function publishNewType(Type $toType, $newStatus) { $this->contentTypeGateway->publishTypeAndFields($toType->id, $toType->status, $newStatus); }
/** * This method updates the given $fieldDefinition on a Type. * * This method creates a new status of the Type with the updated * $fieldDefinition. It does not update existing content objects depending * on the * field (default) values. * * @param mixed $contentTypeId * @param \eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition $fieldDefinition * * @return void */ public function updateFieldDefinition($contentTypeId, $status, FieldDefinition $fieldDefinition) { $storageFieldDef = new StorageFieldDefinition(); $this->mapper->toStorageFieldDefinition($fieldDefinition, $storageFieldDef); $this->contentTypeGateway->updateFieldDefinition($contentTypeId, $status, $fieldDefinition, $storageFieldDef); }