Class

eZ\Publish\API\Repository\Values\Content\Content

abstract class Content extends ValueObject

this class represents a content object in a specific version.

Methods

__construct(array $properties = array())

Construct object optionally with a set of properties.

from ValueObject
__set(string $property, string $value)

Magic set function handling writes to non public properties.

from ValueObject
mixed __get(string $property)

Magic get function handling read to non public properties.

from ValueObject
bool __isset(string $property)

Magic isset function handling isset() to non public properties.

from ValueObject
bool __unset(string $property)

Magic unset function handling unset() to non public properties.

from ValueObject
static ValueObject __set_state(array $array)

Returns a new instance of this class with the data specified by $array.

from ValueObject
mixed attribute(string $property)

Internal function for Legacy template engine compatibility to get property value.

from ValueObject
array attributes()

Internal function for Legacy template engine compatibility to get properties.

from ValueObject
bool hasAttribute(string $property)

Internal function for Legacy template engine compatibility to check existence of property.

from ValueObject
VersionInfo getVersionInfo()

Returns the VersionInfo for this version.

string|null getName(string|null $languageCode = null)

Shorthand method for getVersionInfo()->getName().

Value|null getFieldValue(string $fieldDefIdentifier, string $languageCode = null)

Returns a field value for the given value.

Field[] getFields()

This method returns the complete fields collection.

Field[] getFieldsByLanguage(string $languageCode = null)

This method returns the fields for a given language and non translatable fields.

Field|null getField(string $fieldDefIdentifier, string|null $languageCode = null)

This method returns the field for a given field definition identifier and language.

Details

in ValueObject at line 32
public __construct(array $properties = array())

Construct object optionally with a set of properties.

Readonly properties values must be set using $properties as they are not writable anymore after object has been created.

Parameters

array $properties

in ValueObject at line 75
public __set(string $property, string $value)

Magic set function handling writes to non public properties.

Parameters

string $property Name of the property
string $value

Exceptions

PropertyNotFoundException When property does not exist
PropertyReadOnlyException When property is readonly (protected)

in ValueObject at line 96
public mixed __get(string $property)

Magic get function handling read to non public properties.

Returns value for all readonly (protected) properties.

Parameters

string $property Name of the property

Return Value

mixed

Exceptions

PropertyNotFoundException exception on all reads to undefined properties so typos are not silently accepted.

in ValueObject at line 115
public bool __isset(string $property)

Magic isset function handling isset() to non public properties.

Returns true for all (public/)protected/private properties.

Parameters

string $property Name of the property

Return Value

bool

in ValueObject at line 134
public bool __unset(string $property)

Magic unset function handling unset() to non public properties.

Parameters

string $property Name of the property

Return Value

bool

Exceptions

PropertyNotFoundException exception on all writes to undefined properties so typos are not silently accepted and
PropertyReadOnlyException exception on readonly (protected) properties.

in ValueObject at line 155
static public ValueObject __set_state(array $array)

Returns a new instance of this class with the data specified by $array.

$array contains all the data members of this class in the form: array('member_name'=>value).

__setstate makes this class exportable with varexport. var_export() generates code, that calls this method when it is parsed with PHP.

Parameters

array $array

Return Value

ValueObject

in ValueObject at line 173
final public mixed attribute(string $property)

Internal function for Legacy template engine compatibility to get property value.

Parameters

string $property

Return Value

mixed

in ValueObject at line 189
final public array attributes()

Internal function for Legacy template engine compatibility to get properties.

Return Value

array

in ValueObject at line 207
final public bool hasAttribute(string $property)

Internal function for Legacy template engine compatibility to check existence of property.

Parameters

string $property

Return Value

bool

at line 28
abstract public VersionInfo getVersionInfo()

Returns the VersionInfo for this version.

Return Value

VersionInfo

at line 40
public string|null getName(string|null $languageCode = null)

Shorthand method for getVersionInfo()->getName().

Parameters

string|null $languageCode

Return Value

string|null The name for a given language, or null if $languageCode is not set or does not exist.

See also

\eZ\Publish\API\Repository\Values\Content\VersionInfo::getName()

at line 61
abstract public Value|null getFieldValue(string $fieldDefIdentifier, string $languageCode = null)

Returns a field value for the given value.

On non translatable fields this method ignores the languageCode parameter, and return main language field value.

Parameters

string $fieldDefIdentifier
string $languageCode

Return Value

Value|null a primitive type or a field type Value object depending on the field type.

at line 68
abstract public Field[] getFields()

This method returns the complete fields collection.

Return Value

Field[] An array of {@link Field}

at line 81
abstract public Field[] getFieldsByLanguage(string $languageCode = null)

This method returns the fields for a given language and non translatable fields.

Parameters

string $languageCode

Return Value

Field[] An array of {@link Field} with field identifier as keys

at line 99
abstract public Field|null getField(string $fieldDefIdentifier, string|null $languageCode = null)

This method returns the field for a given field definition identifier and language.

On non translatable fields this method ignores the languageCode parameter, and return main language field.

Parameters

string $fieldDefIdentifier
string|null $languageCode

Return Value

Field|null A {@link Field} or null if nothing is found