eZPublishCommunityProject  2013.5
eZ\Publish\Core\FieldType\Relation\Type Class Reference

The Relation field type. More...

+ Inheritance diagram for eZ\Publish\Core\FieldType\Relation\Type:
+ Collaboration diagram for eZ\Publish\Core\FieldType\Relation\Type:

Public Member Functions

 fromHash ($hash)
 Converts an $hash to the Value defined by the field type. More...
 
 getEmptyValue ()
 Returns the fallback default value of field type when no such default value is provided in the field definition in content types. More...
 
 getFieldTypeIdentifier ()
 Returns the field type identifier for this field type. More...
 
 getName ($value)
 Returns the name of the given field value. More...
 
 getRelations ($fieldValue)
 Returns relation data extracted from value. More...
 
 isSearchable ()
 Returns whether the field type is searchable. More...
 
 toHash ($value)
 Converts a $Value to a hash. More...
 
 validateFieldSettings ($fieldSettings)
 
- Public Member Functions inherited from eZ\Publish\Core\FieldType\FieldType
 acceptValue ($inputValue)
 Potentially builds and checks the type and structure of the $inputValue. More...
 
 applyDefaultSettings (&$fieldSettings)
 Applies the default values to the fieldSettings of a FieldDefinitionCreateStruct. More...
 
 fieldSettingsFromHash ($fieldSettingsHash)
 Converts the given $fieldSettingsHash to field settings of the type. More...
 
 fieldSettingsToHash ($fieldSettings)
 Converts the given $fieldSettings to a simple hash format. More...
 
 fromPersistenceValue (FieldValue $fieldValue)
 Converts a persistence $fieldValue to a Value. More...
 
 getRelations ($fieldValue)
 Returns relation data extracted from value. More...
 
 getSettingsSchema ()
 Returns a schema for the settings expected by the FieldType. More...
 
 getValidatorConfigurationSchema ()
 Returns a schema for the validator configuration expected by the FieldType. More...
 
 isEmptyValue ($value)
 Returns if the given $value is considered empty by the field type. More...
 
 isSearchable ()
 Returns whether the field type is searchable. More...
 
 toPersistenceValue ($value)
 Converts a $value to a persistence value. More...
 
 validate (FieldDefinition $fieldDefinition, $fieldValue)
 Validates a field based on the validators in the field definition. More...
 
 validateFieldSettings ($fieldSettings)
 Validates the fieldSettings of a FieldDefinitionCreateStruct or FieldDefinitionUpdateStruct. More...
 
 validateValidatorConfiguration ($validatorConfiguration)
 Validates the validatorConfiguration of a FieldDefinitionCreateStruct or FieldDefinitionUpdateStruct. More...
 
 validatorConfigurationFromHash ($validatorConfigurationHash)
 Converts the given $validatorConfigurationHash to a validator configuration of the type. More...
 
 validatorConfigurationToHash ($validatorConfiguration)
 Converts the given $validatorConfiguration to a simple hash format. More...
 

Public Attributes

const SELECTION_BROWSE = 0
 
const SELECTION_DROPDOWN = 1
 

Protected Member Functions

 getSortInfo ($value)
 Returns information for FieldValue->$sortKey relevant to the field type. More...
 
 internalAcceptValue ($inputValue)
 Checks the type and structure of the $Value. More...
 
- Protected Member Functions inherited from eZ\Publish\Core\FieldType\FieldType
 getSortInfo ($value)
 Returns information for FieldValue->$sortKey relevant to the field type. More...
 
 internalAcceptValue ($inputValue)
 Implements the core of {. More...
 

Protected Attributes

 $settingsSchema
 
- Protected Attributes inherited from eZ\Publish\Core\FieldType\FieldType
 $settingsSchema = array()
 
 $validatorConfigurationSchema = array()
 

Detailed Description

The Relation field type.

This field type represents a relation to a content.

hash format ({

See Also
fromhash()}, {
toHash()}): array( 'destinationContentId' => (int)$destinationContentId );

Member Function Documentation

eZ\Publish\Core\FieldType\Relation\Type::fromHash (   $hash)

Converts an $hash to the Value defined by the field type.

Parameters
mixed$hash
Returns
$value

Implements eZ\Publish\API\Repository\FieldType.

eZ\Publish\Core\FieldType\Relation\Type::getEmptyValue ( )

Returns the fallback default value of field type when no such default value is provided in the field definition in content types.

Returns

Implements eZ\Publish\API\Repository\FieldType.

eZ\Publish\Core\FieldType\Relation\Type::getFieldTypeIdentifier ( )

Returns the field type identifier for this field type.

Returns
string

Implements eZ\Publish\API\Repository\FieldType.

eZ\Publish\Core\FieldType\Relation\Type::getName (   $value)

Returns the name of the given field value.

It will be used to generate content name and url alias if current field is designated to be used in the content name/urlAlias pattern.

Parameters
mixed$value
Returns
mixed

Implements eZ\Publish\API\Repository\FieldType.

eZ\Publish\Core\FieldType\Relation\Type::getRelations (   $fieldValue)

Returns relation data extracted from value.

Not intended for ::COMMON type relations, there is an API for handling those.

Parameters
mixed$fieldValue
Returns
array Hash with relation type as key and array of destination content ids as value.

Example: array( ::LINK => array( "contentIds" => array( 12, 13, 14 ), "locationIds" => array( 24 ) ), ::EMBED => array( "contentIds" => array( 12 ), "locationIds" => array( 24, 45 ) ), ::ATTRIBUTE => array( 12 ) )

eZ\Publish\Core\FieldType\Relation\Type::getSortInfo (   $value)
protected

Returns information for FieldValue->$sortKey relevant to the field type.

For this FieldType, the related object's name is returned.

Todo:
Repository needs to be provided to be able to get Content Relation name(s), and it is in ctor
Returns
array
eZ\Publish\Core\FieldType\Relation\Type::internalAcceptValue (   $inputValue)
protected

Checks the type and structure of the $Value.

Exceptions
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif the parameter is not of the supported value sub type
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif the value does not match the expected structure
Parameters
mixed$inputValueA ContentInfo or content ID to build from, or a Relation
Returns
The potentially converted and structurally plausible value.
eZ\Publish\Core\FieldType\Relation\Type::isSearchable ( )

Returns whether the field type is searchable.

Returns
boolean

Implements eZ\Publish\API\Repository\FieldType.

eZ\Publish\Core\FieldType\Relation\Type::toHash (   $value)

Converts a $Value to a hash.

Parameters
\eZ\Publish\Core\FieldType\Relation\Value$value
Returns
mixed

Implements eZ\Publish\API\Repository\FieldType.

eZ\Publish\Core\FieldType\Relation\Type::validateFieldSettings (   $fieldSettings)
See Also
::validateFieldSettings()
Parameters
mixed$fieldSettings
Returns
[]

Member Data Documentation

eZ\Publish\Core\FieldType\Relation\Type::$settingsSchema
protected
Initial value:
= array(
'selectionMethod' => array(
'type' => 'int',
'default' => self::SELECTION_BROWSE,
),
'selectionRoot' => array(
'type' => 'string',
'default' => '',
),
)
const eZ\Publish\Core\FieldType\Relation\Type::SELECTION_BROWSE = 0
const eZ\Publish\Core\FieldType\Relation\Type::SELECTION_DROPDOWN = 1

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