eZPublishCommunityProject  2013.6
eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler Class Reference

Field Handler. More...

Public Member Functions

 __construct (Gateway $contentGateway, Mapper $mapper, StorageHandler $storageHandler, LanguageHandler $languageHandler, FieldTypeRegistry $fieldTypeRegistry)
 Creates a new Field Handler. More...
 
 createExistingFieldsInNewVersion (Content $content)
 Creates existing fields in a new version for $content. More...
 
 createNewFields (Content $content)
 Creates new fields in the database from $content. More...
 
 deleteFields ($contentId, VersionInfo $versionInfo)
 Deletes the fields for $contentId in $versionInfo from the database. More...
 
 loadExternalFieldData (Content $content)
 Performs external loads for the fields in $content. More...
 
 updateFields (Content $content, UpdateStruct $updateStruct)
 Updates the fields in for content identified by $contentId and $versionNo in the database in respect to $updateStruct. More...
 

Public Attributes

 $typeHandler
 

Protected Member Functions

 copyField (Field $originalField, $languageCode, Content $content)
 Copies existing field to new field for given $languageCode. More...
 
 copyFields (array $fields, Content $content)
 
 createExistingFieldInNewVersion (Field $originalField, Content $content, $newLanguageCode=null)
 Creates an existing field in a new version, no new ID is generated. More...
 
 createNewField (Field $field, Content $content)
 Creates a new field in the database. More...
 
 getEmptyField (FieldDefinition $fieldDefinition, $languageCode)
 Returns empty Field object for given field definition and language code. More...
 
 getFieldMap (array $fields, &$languageCodes=null)
 Returns given $fields structured in hash array with field definition ids and language codes as keys. More...
 
 getLanguageCodes (array $languageIds)
 For given $languageIds returns array with language codes as keys. More...
 
 updateField (Field $field, Content $content)
 Updates an existing field in the database. More...
 

Protected Attributes

 $contentGateway
 
 $fieldTypeRegistry
 
 $fieldTypes
 
 $languageHandler
 
 $mapper
 
 $storageHandler
 

Detailed Description

Field Handler.

Constructor & Destructor Documentation

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::__construct ( Gateway  $contentGateway,
Mapper  $mapper,
StorageHandler  $storageHandler,
LanguageHandler  $languageHandler,
FieldTypeRegistry  $fieldTypeRegistry 
)

Creates a new Field Handler.

Parameters
\eZ\Publish\Core\Persistence\Legacy\Content\Gateway$contentGateway
\eZ\Publish\Core\Persistence\Legacy\Content\Mapper$mapper
\eZ\Publish\Core\Persistence\Legacy\Content\StorageHandler$storageHandler
\eZ\Publish\SPI\Persistence\Content\Language\Handler$languageHandler
\eZ\Publish\Core\Persistence\FieldTypeRegistry$fieldTypeRegistry

Member Function Documentation

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::copyField ( Field  $originalField,
  $languageCode,
Content  $content 
)
protected

Copies existing field to new field for given $languageCode.

Used by self::createNewFields() and self::updateFields()

Parameters
\eZ\Publish\SPI\Persistence\Content\Field$originalField
string$languageCode
\eZ\Publish\SPI\Persistence\Content$content
Returns
void

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\copyFields().

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::copyFields ( array  $fields,
Content  $content 
)
protected
Parameters
array$fields
\eZ\Publish\SPI\Persistence\Content$content
Returns
void

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\createNewFields(), and eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\updateFields().

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::createExistingFieldInNewVersion ( Field  $originalField,
Content  $content,
  $newLanguageCode = null 
)
protected

Creates an existing field in a new version, no new ID is generated.

If $newLanguageCode is set field will be created in it. This is used for creating non-translatable fields from field in main language.

External data is being copied here as some FieldTypes require original field external data. By default copying falls back to storing, it is upon external storage implementation to override the behaviour as needed.

Parameters
Field$originalField
Content$content
string | null$newLanguageCode
Returns

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\createExistingFieldsInNewVersion().

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::createExistingFieldsInNewVersion ( Content  $content)

Creates existing fields in a new version for $content.

Parameters
\eZ\Publish\SPI\Persistence\Content$content
Returns
void
eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::createNewField ( Field  $field,
Content  $content 
)
protected

Creates a new field in the database.

Used by self::createNewFields() and self::updateFields()

Parameters
\eZ\Publish\SPI\Persistence\Content\Field$field
\eZ\Publish\SPI\Persistence\Content$content
Returns
void

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\createNewFields(), and eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\updateFields().

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::createNewFields ( Content  $content)

Creates new fields in the database from $content.

Parameters
\eZ\Publish\SPI\Persistence\Content$content
Returns
void
eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::deleteFields (   $contentId,
VersionInfo  $versionInfo 
)

Deletes the fields for $contentId in $versionInfo from the database.

Parameters
int$contentId
\eZ\Publish\SPI\Persistence\Content\VersionInfo$versionInfo
Returns
void
eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::getEmptyField ( FieldDefinition  $fieldDefinition,
  $languageCode 
)
protected

Returns empty Field object for given field definition and language code.

Uses FieldType to create empty field value.

Parameters
\eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition$fieldDefinition
string$languageCode
Returns

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\createNewFields(), and eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\updateFields().

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::getFieldMap ( array  $fields,
$languageCodes = null 
)
protected

Returns given $fields structured in hash array with field definition ids and language codes as keys.

Parameters
\eZ\Publish\SPI\Persistence\Content\Field[]$fields
array$languageCodes
Returns
[][]

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\createExistingFieldsInNewVersion(), eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\createNewFields(), and eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\updateFields().

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::getLanguageCodes ( array  $languageIds)
protected

For given $languageIds returns array with language codes as keys.

Parameters
array$languageIds
Returns
array

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\createExistingFieldsInNewVersion(), and eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\updateFields().

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::loadExternalFieldData ( Content  $content)

Performs external loads for the fields in $content.

Parameters
Content$content
Returns
void
eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::updateField ( Field  $field,
Content  $content 
)
protected

Updates an existing field in the database.

Used by self::createNewFields() and self::updateFields()

Parameters
\eZ\Publish\SPI\Persistence\Content\Field$field
\eZ\Publish\SPI\Persistence\Content$content
Returns
void

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\updateFields().

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::updateFields ( Content  $content,
UpdateStruct  $updateStruct 
)

Updates the fields in for content identified by $contentId and $versionNo in the database in respect to $updateStruct.

Parameters
\eZ\Publish\SPI\Persistence\Content$content
\eZ\Publish\SPI\Persistence\Content\UpdateStruct$updateStruct
Returns
void

Member Data Documentation

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::$contentGateway
protected
eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::$fieldTypeRegistry
protected
eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::$fieldTypes
protected
eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::$languageHandler
protected
eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::$mapper
protected
eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::$storageHandler
protected
eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::$typeHandler

The documentation for this class was generated from the following file: