eZ Publish Community Project (Legacy Stack) 2013.4
Class

eZContentObject

class eZContentObject extends eZPersistentObject

Constants

STATUS_DRAFT

STATUS_PUBLISHED

STATUS_ARCHIVED

PACKAGE_ERROR_NO_CLASS

PACKAGE_ERROR_EXISTS

PACKAGE_ERROR_NODE_EXISTS

PACKAGE_ERROR_MODIFIED

PACKAGE_ERROR_HAS_CHILDREN

PACKAGE_REPLACE

PACKAGE_SKIP

PACKAGE_NEW

PACKAGE_UPDATE

PACKAGE_DELETE

PACKAGE_KEEP

RELATION_COMMON

RELATION_EMBED

RELATION_LINK

RELATION_ATTRIBUTE

Properties

bool $PersistentDataDirty Whether the data is dirty, ie needs to be stored, or not.
$ID
$Name
$CurrentLanguage
$ClassName
$ClassIdentifier
$DataMap
$ContentActionList
$ContentObjectAttributes
$MainNodeID
$InputRelationList

Methods

eZPersistentObject(int|array $row)

Initializes the object with the $row.

from eZPersistentObject
bool fill(array $row)

Tries to fill in the data in the object by using the object definition which is returned by the function definition() and the database row data $row.

from eZPersistentObject
static void replaceFieldsWithShortNames(eZDBInterface $db, array $fieldDefs, array $fields)

For the given array $fields treats its keys (for associative array) or values (for non-associative array) as table fields names and replaces them with short names (aliases) found in $fieldDefs.

from eZPersistentObject
static int count(array $def, array|null $conds = null, string|null $field = null)

Fetches the number of rows by using the object definition.

from eZPersistentObject
static eZPersistentObject|array|null fetchObject($def, $field_filters, $conds, $asObject = true, $grouping = null, $custom_fields = null)

Fetches and returns an object based on the given parameters and returns is either as an object or as an array

from eZPersistentObject
void remove(array|null $conditions = null, array|null $extraConditions = null)

Removes the object from the database, it will use the keys in the object definition to figure out which table row should be removed unless $conditions is defined as an array with fieldnames.

from eZPersistentObject
static void removeObject(array $def, array|null $conditions = null, array|null $extraConditions = null)

Deletes the object from the table defined in $def with conditions $conditions and extra conditions \a $extraConditions.

from eZPersistentObject
void store(array|null $fieldFilters = null)

Stores the object in the database, uses storeObject() to do the actual job and passes $fieldFilters to it.

void sync(array|null $fieldFilters = null)

Makes sure data is stored if the data is considered dirty.

from eZPersistentObject
static void storeObject(eZPersistentObject $obj, array|null $fieldFilters = null)

Stores the data in $obj to database.

from eZPersistentObject
static string conditionText(array $conditions)

Calls conditionTextByRow with an empty row and $conditions.

from eZPersistentObject
static string conditionTextByRow(array $conditions, array|null $row)

Generates an SQL sentence from the conditions \a $conditions and row data $row.

from eZPersistentObject
static eZPersistentObject[]|array|null fetchObjectList(array $def, array|null $field_filters = null, array|null $conds = null, array|null|bool $sorts = null, array|null $limit = null, bool $asObject = true, array|null|bool $grouping = false, null $custom_fields = null, array|null $custom_tables = null, string|null $custom_conds = null)

Creates an SQL query out of the different parameters and returns an array with the result.

from eZPersistentObject
static eZPersistentObject[]|array handleRows(array $rows, string $class_name, bool $asObject)

Creates PHP objects out of the database rows $rows.

from eZPersistentObject
static string swapRow(string $table, array $keys, int $order_id, array $rows, int $id1, int $id2)

Sets row id $id2 to have the placement of row id $id1.

from eZPersistentObject
static int newObjectOrder(array $def, string $orderField, array $conditions)

Returns an order value which can be used for new items in table, for instance placement.

from eZPersistentObject
static void reorderObject(array $def, array $orderField, array $conditions, bool $down = true)

Moves a row in a database table.

from eZPersistentObject
static array definition()

Returns the definition for the object, the default implementation is to return an empty array.

from eZPersistentObject
static array escapeArray(array $array)

Escapes strings in an array with the help of {@link eZDBInterface::escapeString()}

from eZPersistentObject
static void updateObjectList(array $parameters)

Updates rows matching the given parameters

from eZPersistentObject
array attributes()

Returns the attributes for this object, taken from the definition fields and function attributes.

from eZPersistentObject
bool hasAttribute(string $attr)

Checks if $attr is part of the definition fields or function attributes.

from eZPersistentObject
mixed attribute(string $attr, bool $noFunction = false)

Returns the attribute data for $attr, this is either returned from the member variables or a member function depending on whether the definition field or function attributes matched.

from eZPersistentObject
void setAttribute(string $attr, mixed $val)

Sets the attribute $attr to the value $val.

from eZPersistentObject
bool hasDirtyData()

Returns true if the data is considered dirty and needs to be stored.

from eZPersistentObject
void setHasDirtyData(bool $hasDirtyData)

Sets whether the object has dirty data or not.

from eZPersistentObject
static string getShortAttributeName(eZDBInterface $db, array $def, string $attrName)

Returns the short attribute name (alias) if it's defined, given attribute name otherwise

from eZPersistentObject
eZContentObject($row)

matchIngroupIDList()

storeNodeModified()

name($version = false, $lang = false)

names()

versionLanguageName($version, $lang = false)

setCachedName($name)

setName($objectName, $versionNum = false, $languageCode = false)

dataMap()

array groupedDataMap()

Generates a map with all the content object attributes where the keys are the attribute identifiers grouped by class attribute category.

static array createGroupedDataMap(array $contentObjectAttributes)

Generates a map with all the content object attributes where the keys are the attribute identifiers grouped by class attribute category.

fetchDataMap($version = false, $language = false)

resetDataMap()

fetchAttributesByIdentifier($identifierArray, $version = false, $languageArray = false, $asObject = true)

owner()

contentClassGroupIDList()

contentClassIdentifier()

contentClass()

remoteID()

mainParentNodeID()

currentVersion($asObject = true)

version($version, $asObject = true)

array versions(boolean $asObject = true, array $parameters = array())

Returns an array of eZContentObjectVersion for the current object according to the conditions in $parameters.

hasRemainingVersions()

createInitialVersion($userID, $initialLanguageCode = false)

createNewVersionIn($languageCode, $copyFromLanguageCode = false, $copyFromVersion = false, $versionCheck = true, $status = eZContentObjectVersion::STATUS_DRAFT)

createNewVersion($copyFromVersion = false, $versionCheck = true, $languageCode = false, $copyFromLanguageCode = false, $status = eZContentObjectVersion::STATUS_DRAFT)

copyVersion($newObject, $version, $newVersionNumber, $contentObjectID = false, $status = eZContentObjectVersion::STATUS_DRAFT, $languageCode = false, $copyFromLanguageCode = false)

__clone()

copy($allVersions = true)

copyRevertTo($version, $language = false)

purge()

removeThis($nodeID = null)

cleanupInternalDrafts($userID = false, $timeDuration = 86400)

eZContentObjectAttribute[]|array|null allContentObjectAttributes(int $contentObjectID, bool $asObject = true, array|null $limit = null)

Fetches all attributes from any versions of the content object

contentObjectAttributes($asObject = true, $version = false, $language = false, $contentObjectAttributeID = false, $distinctItemsOnly = false)

setContentObjectAttributes($attributes, $version, $language)

resetInputRelationList()

appendInputRelationList($addingIDList, $relationType)

commitInputRelations($editVersion)

validateInput($contentObjectAttributes, $attributeDataBaseName, $inputParameters = false, $parameters = array())

fixupInput($contentObjectAttributes, $attributeDataBaseName)

fetchInput($contentObjectAttributes, $attributeDataBaseName, $customActionAttributeArray, $customActionParameters)

handleCustomHTTPActions($contentObjectAttribute, $attributeDataBaseName, $customActionAttributeArray, $customActionParameters)

handleAllCustomHTTPActions($attributeDataBaseName, $customActionAttributeArray, $customActionParameters, $objectVersion = false)

storeInput($contentObjectAttributes, $attributeInputMap)

nextVersion()

previousVersion()

getVersionCount()

currentLanguage()

currentLanguageObject()

setCurrentLanguage($lang)

initialLanguage()

initialLanguageCode()

addLocation($parentNodeID, $asObject = false)

addContentObjectRelation($toObjectID, $fromObjectVersion = false, $attributeID, $relationType = eZContentObject::RELATION_COMMON)

removeContentObjectRelation($toObjectID = false, $fromObjectVersion = false, $attributeID, $relationType = eZContentObject::RELATION_COMMON)

copyContentObjectRelations($currentVersion, $newVersion, $newObjectID = false)

relatedObjects($fromObjectVersion = false, $objectID = false, $attributeID, $groupByAttribute = false, $params = false, $reverseRelatedObjects = false)

relatedContentObjectList($fromObjectVersion = false, $fromObjectID = false, $attributeID, $groupByAttribute = false, $params = false)

linkedContentObjectList($fromObjectVersion = false, $fromObjectID = false)

embeddedContentObjectList($fromObjectVersion = false, $fromObjectID = false)

reverseLinkedObjectList($fromObjectVersion = false, $fromObjectID = false)

reverseEmbeddedObjectList($fromObjectVersion = false, $fromObjectID = false)

relatedContentObjectArray($fromObjectVersion = false, $fromObjectID = false, $attributeID, $params = false)

relatedContentObjectCount($fromObjectVersion = false, $attributeID, $params = false)

reverseRelatedObjectList($version = false, $attributeID, $groupByAttribute = false, $params = false)

linkedContentObjectCount($fromObjectVersion = false)

embeddedContentObjectCount($fromObjectVersion = false)

reverseLinkedObjectCount($fromObjectVersion = false)

reverseEmbeddedObjectCount($fromObjectVersion = false)

int relatedObjectCount(int $version = false, int $attributeID, int|false $reverseRelatedObjects = false, array|false $params = false)

Fetch the number of (reverse) related objects

reverseRelatedObjectCount($version = false, $attributeID, $params = false)

contentObjectListRelatingThis($version = false)

parentNodeIDArray()

parentNodes($version = false, $asObject = true)

createNodeAssignment($parentNodeID, $isMain, $remoteID = false, $sortField = eZContentObjectTreeNode::SORT_FIELD_PUBLISHED, $sortOrder = eZContentObjectTreeNode::SORT_ORDER_DESC)

assignedNodes($asObject = true)

mainNodeID()

mainNode()

setPermissions($permissionArray)

permissions()

canEditLanguages()

canCreateLanguages()

checkGroupLimitationAccess($limitationValueList, $userID, $contentObjectID = false)

checkAccess($functionName, $originalClassID = false, $parentClassID = false, $returnAccessList = false, $language = false)

classListFromPolicy($policy, $allowedLanguageCodes = false)

canCreateClassList($asObject = false, $includeFilter = true, $groupList = false, $fetchID = false)

accessList($function)

canRead()

canPdf()

canViewEmbed()

canDiff()

canCreate()

canEdit($originalClassID = false, $parentClassID = false, $returnAccessList = false, $language = false)

canTranslate()

canRemove()

canMoveFrom()

className()

contentActionList()

hasContentAction($name)

availableLanguages()

availableLanguagesJsArray()

languages()

allLanguages()

setClassName($name)

fetchClassAttributes($version, $asObject = true)

postUnserialize($package)

serialize($package, $specificVersion = false, $options = false, $contentNodeIDArray = false, $topNodeIDArray = false)

cacheInfo($Params)

authorArray()

rename($newName)

removeTranslation($languageID)

isAlwaysAvailable()

setAlwaysAvailableLanguageID($languageID, $version = false)

allowedAssignSectionList()

array allowedAssignStateIDList(eZUser $user = null)

Gets a list of states a user is allowed to put the content object in.

allowedAssignStateList(eZUser $user = null)

array stateIDArray(boolean $refreshCache = false)

Gets the current states of the content object.

stateIdentifierArray()

boolean assignState(eZContentObjectState $state)

Sets the state of a content object.

assignDefaultStates()

Sets the default states of a content object.

restoreObjectAttributes()

Restores attributes for current content object when it's being restored from trash

string sectionIdentifier()

Returns object's section identifier

Details

in eZPersistentObject at line 52
public eZPersistentObject(int|array $row)

Initializes the object with the $row.

It will try to set each field taken from the database row. Calls fill to do the job. If $row is an integer, it will try to fetch it from the database using it as the unique ID.

Parameters

int|array $row

in eZPersistentObject at line 71
public bool fill(array $row)

Tries to fill in the data in the object by using the object definition which is returned by the function definition() and the database row data $row.

Each field will be fetch from the definition and then use that fieldname to fetch from the row and set the data.

Parameters

array $row

Return Value

bool

in eZPersistentObject at line 101
static public void replaceFieldsWithShortNames(eZDBInterface $db, array $fieldDefs, array $fields)

For the given array $fields treats its keys (for associative array) or values (for non-associative array) as table fields names and replaces them with short names (aliases) found in $fieldDefs.

Parameters

eZDBInterface $db
array $fieldDefs
array $fields

Return Value

void

in eZPersistentObject at line 147
static public int count(array $def, array|null $conds = null, string|null $field = null)

Fetches the number of rows by using the object definition.

Uses fetchObjectList for the actual SQL handling. See {@link eZPersistentObject::fetchObjectList()} for a full description of the input parameters.

Parameters

array $def A definition array of all fields, table name and sorting (see {@link eZPersistentObject::definition()} for more info)
array|null $conds
string|null $field

Return Value

int

in eZPersistentObject at line 173
static public eZPersistentObject|array|null fetchObject($def, $field_filters, $conds, $asObject = true, $grouping = null, $custom_fields = null)

Fetches and returns an object based on the given parameters and returns is either as an object or as an array

See {@link eZPersistentObject::fetchObjectList()} for a full description of the input parameters.

Parameters

$def
$field_filters
$conds
$asObject
$grouping
$custom_fields

Return Value

eZPersistentObject|array|null

in eZPersistentObject at line 199
public void remove(array|null $conditions = null, array|null $extraConditions = null)

Removes the object from the database, it will use the keys in the object definition to figure out which table row should be removed unless $conditions is defined as an array with fieldnames.

It uses removeObject to do the real job and passes the object defintion, conditions and extra conditions \a $extraConditions to this function.

Note: Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Parameters

array|null $conditions
array|null $extraConditions

Return Value

void

in eZPersistentObject at line 231
static public void removeObject(array $def, array|null $conditions = null, array|null $extraConditions = null)

Deletes the object from the table defined in $def with conditions $conditions and extra conditions \a $extraConditions.

The extra conditions will either be appended to the existing conditions or overwrite existing fields.

Uses conditionText() to create the condition SQL.

Note: Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Parameters

array $def A definition array of all fields, table name and sorting (see {@link eZPersistentObject::definition()} for more info)
array|null $conditions
array|null $extraConditions

Return Value

void

at line 243
public void store(array|null $fieldFilters = null)

Stores the object in the database, uses storeObject() to do the actual job and passes $fieldFilters to it.

Note: Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Parameters

array|null $fieldFilters

Return Value

void

in eZPersistentObject at line 279
public void sync(array|null $fieldFilters = null)

Makes sure data is stored if the data is considered dirty.

Note: Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Parameters

array|null $fieldFilters

Return Value

void

in eZPersistentObject at line 298
static public void storeObject(eZPersistentObject $obj, array|null $fieldFilters = null)

Stores the data in $obj to database.

Note: Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Parameters

eZPersistentObject $obj
array|null $fieldFilters If specified only certain fields will be stored.

Return Value

void

in eZPersistentObject at line 583
static public string conditionText(array $conditions)

Calls conditionTextByRow with an empty row and $conditions.

Parameters

array $conditions

Return Value

string

in eZPersistentObject at line 598
static public string conditionTextByRow(array $conditions, array|null $row)

Generates an SQL sentence from the conditions \a $conditions and row data $row.

If $row is empty (or null) it uses the condition data instead of row data.

Parameters

array $conditions
array|null $row

Return Value

string

in eZPersistentObject at line 761
static public eZPersistentObject[]|array|null fetchObjectList(array $def, array|null $field_filters = null, array|null $conds = null, array|null|bool $sorts = null, array|null $limit = null, bool $asObject = true, array|null|bool $grouping = false, null $custom_fields = null, array|null $custom_tables = null, string|null $custom_conds = null)

Creates an SQL query out of the different parameters and returns an array with the result.

A full example: $filter = array( 'id', 'name' ); $conds = array( 'type' => 5, 'size' => array( false, array( 200, 500 ) ) ); $sorts = array( 'name' => 'asc' ); $limit = array( 'offset' => 50, 'length' => 10 ); eZPersistentObject::fetchObjectList( $def, $filter, $conds, $sorts, $limit, true, false, null )

Counting number of elements. $custom = array( array( 'operation' => 'count( id )', 'name' => 'count' ) ); // Here $field_filters is set to an empty array, that way only count is used in fields $rows = eZPersistentObject::fetchObjectList( $def, array(), null, null, null, false, false, $custom ); return $rows[0]['count'];

Counting elements per type using grouping $custom = array( array( 'operation' => 'count( id )', 'name' => 'count' ) ); $group = array( 'type' ); $rows = eZPersistentObject::fetchObjectList( $def, array(), null, null, null, false, $group, $custom ); return $rows[0]['count'];

Example to fetch a result with custom conditions. The following example will fetch the attributes to the contentobject with id 1 and add the contentobject.name in each attribute row with the array key contentobject_name. $objectDef = eZContentObject::definition(); $objectAttributeDef = eZContentObjectAttribute::definition();

$fields = array(); $conds = array( $objectDef['name'] . '.id' => 1 ); $sorts = array( $objectAttributeDef['name'] . '.sortkeystring' => 'asc' );

$limit = null; $asObject = false; $group = false;

$customFields = array( $objectAttributeDef['name'] . '.*', array( 'operation' => $objectDef['name'] . '.name', 'name' => 'contentobject_name' ) );

$customTables = array( $objectDef['name'] );

$languageCode = 'eng-GB'; $customConds = ' AND ' . $objectDef['name'] . '.currentversion=' . $objectAttributeDef['name'] . '.version' . ' AND ' . $objectDef['name'] . '.id=' . $objectAttributeDef['name'] . '.contentobjectid' . ' AND ' . $objectAttributeDef['name'] . '.language_code=\'' . $languageCode . '\'';

$rows = eZPersistentObject::fetchObjectList( $objectAttributeDef, $fields, $conds, $sorts, $limit, $asObject, $group, $customFields, $customTables, $customConds );

Parameters

array $def A definition array of all fields, table name and sorting (see {@link eZPersistentObject::definition()} for more info)
array|null $field_filters If defined determines the fields which are extracted (array of field names), if not all fields are fetched
array|null $conds null for no special condition or an associative array of fields to filter on. Syntax is FIELD => CONDITION CONDITION can be one of: - Scalar value: Creates a condition where FIELD must match the value, e.g array( 'id' => 5 ) generates SQL id = 5 - Array with two scalar values: The first value is the match operator, the second is the scalar value array( 'priority' => array( '>', 5 ) ) generates SQL priority > 5 - Array with range: The first value is false, the second value is an array with start and stop of range in array array( 'type' => array( false, array( 1, 5 ) ) ) generates SQL type BETWEEN 1 AND 5 - Array with multiple elements: The first value is the field identifier, the second is an array with scalar values array( 'id' => array( array( 1, 5, 7 ) ) ) generates SQL id IN ( 1, 5, 7 )
array|null|bool $sorts An associative array of sorting conditions, if set to false ignores settings in $def, if set to null uses settingss in $def. Syntax is FIELD => DIRECTION. DIRECTION must either be 'asc' for ascending or 'desc' for descending.
array|null $limit An associative array with limitiations, can contain - 'offset': Numerical value defining the start offset for the fetch - 'length': Numerical value defining the max number of items to return
bool $asObject If true then it will return an array with objects, objects are created from class defined in $def. If falseit will just return the rows fetch from database.
array|null|bool $grouping An array of fields to group by or null to use grouping in defintion $def.
null $custom_fields Array of FIELD elements to add to SQL, can be used to perform custom fetches, e.g counts. FIELD is an associative array containing: - 'operation': A text field which is included in the field list - 'name': If present it adds AS name to the operation.
array|null $custom_tables Array of additional tables
string|null $custom_conds String with sql conditions for 'WHERE' clause.

Return Value

eZPersistentObject[]|array|null An array of objects or rows, null on error

in eZPersistentObject at line 918
static public eZPersistentObject[]|array handleRows(array $rows, string $class_name, bool $asObject)

Creates PHP objects out of the database rows $rows.

Each object is created from class \$ class_name and is passed as a row array as parameter.

Parameters

array $rows
string $class_name
bool $asObject If true then objects will be created, if not it just returns $rows as it is.

Return Value

eZPersistentObject[]|array

in eZPersistentObject at line 951
static public string swapRow(string $table, array $keys, int $order_id, array $rows, int $id1, int $id2)

Sets row id $id2 to have the placement of row id $id1.

Note: Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Parameters

string $table
array $keys
int $order_id
array $rows
int $id1
int $id2

Return Value

string

in eZPersistentObject at line 978
static public int newObjectOrder(array $def, string $orderField, array $conditions)

Returns an order value which can be used for new items in table, for instance placement.

Uses $def, $orderField and $conditions to figure out the currently maximum order value and returns one that is larger.

Parameters

array $def A definition array of all fields, table name and sorting (see {@link eZPersistentObject::definition()} for more info)
string $orderField
array $conditions

Return Value

int

in eZPersistentObject at line 1013
static public void reorderObject(array $def, array $orderField, array $conditions, bool $down = true)

Moves a row in a database table.

Uses $orderField to determine the order of objects in a table, usually this is a placement of some kind. It uses this order field to figure out how move the row, the row is either swapped with another row which is either above or below according to whether $down is true or false, or it is swapped with the first item or the last item depending on whether this row is first or last. Uses $conditions to figure out unique rows.

Note: Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Parameters

array $def A definition array of all fields, table name and sorting (see {@link eZPersistentObject::definition()} for more info)
array $orderField Associative array with one element, the key is the order id and values is order value.
array $conditions
bool $down

Return Value

void

in eZPersistentObject at line 1110
static public array definition()

Returns the definition for the object, the default implementation is to return an empty array.

It's upto each inheriting class to return a proper definition array.

The definition array is an associative array consists of these keys: - fields: an associative array of fields which defines which database field (the key) is to fetched and how they map to object member variables (the value). - keys: an array of fields which is used for uniquely identifying the object in the table. - function_attributes: an associative array of attributes which maps to member functions, used for fetching data with functions.

Example: public static function definition() { return array( "fields" => array( "id" => "ID", "version" => "Version", "name" => "Name" ), "keys" => array( "id", "version" ), "functionattributes" => array( "current" => "currentVersion", "classname" => "className" ), "incrementkey" => "id", "classname" => "eZContentClass", "sort" => array( "id" => "asc" ), "name" => "ezcontentclass" ); }

Return Value

array

in eZPersistentObject at line 1121
static public array escapeArray(array $array)

Escapes strings in an array with the help of {@link eZDBInterface::escapeString()}

Parameters

array $array

Return Value

array

in eZPersistentObject at line 1153
static public void updateObjectList(array $parameters)

Updates rows matching the given parameters

Note: Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Parameters

array $parameters

Return Value

void

in eZPersistentObject at line 1236
public array attributes()

Returns the attributes for this object, taken from the definition fields and function attributes.

Return Value

array

See also

eZPersistentObject::definition()

in eZPersistentObject at line 1253
public bool hasAttribute(string $attr)

Checks if $attr is part of the definition fields or function attributes.

Parameters

string $attr

Return Value

bool

in eZPersistentObject at line 1273
public mixed attribute(string $attr, bool $noFunction = false)

Returns the attribute data for $attr, this is either returned from the member variables or a member function depending on whether the definition field or function attributes matched.

Parameters

string $attr
bool $noFunction

Return Value

mixed

in eZPersistentObject at line 1318
public void setAttribute(string $attr, mixed $val)

Sets the attribute $attr to the value $val.

The attribute must be present in the objects definition fields or set functions.

Parameters

string $attr
mixed $val

Return Value

void

in eZPersistentObject at line 1358
public bool hasDirtyData()

Returns true if the data is considered dirty and needs to be stored.

Return Value

bool

in eZPersistentObject at line 1369
public void setHasDirtyData(bool $hasDirtyData)

Sets whether the object has dirty data or not.

Parameters

bool $hasDirtyData

Return Value

void

in eZPersistentObject at line 1382
static public string getShortAttributeName(eZDBInterface $db, array $def, string $attrName)

Returns the short attribute name (alias) if it's defined, given attribute name otherwise

Parameters

eZDBInterface $db
array $def A definition array of all fields, table name and sorting (see {@link eZPersistentObject::definition()} for more info)
string $attrName

Return Value

string

at line 47
public eZContentObject($row)

Parameters

$row

at line 226
public matchIngroupIDList()

at line 299
public storeNodeModified()

at line 315
public name($version = false, $lang = false)

Parameters

$version
$lang

at line 335
public names()

at line 351
public versionLanguageName($version, $lang = false)

Parameters

$version
$lang

at line 429
public setCachedName($name)

Parameters

$name

at line 439
public setName($objectName, $versionNum = false, $languageCode = false)

Parameters

$objectName
$versionNum
$languageCode

at line 507
public dataMap()

at line 520
public array groupedDataMap()

Generates a map with all the content object attributes where the keys are the attribute identifiers grouped by class attribute category.

Return Value

array

at line 534
static public array createGroupedDataMap(array $contentObjectAttributes)

Generates a map with all the content object attributes where the keys are the attribute identifiers grouped by class attribute category.

Parameters

array $contentObjectAttributes Array of eZContentObjectAttribute objects

Return Value

array

at line 562
public fetchDataMap($version = false, $language = false)

Parameters

$version
$language

at line 610
public resetDataMap()

at line 621
public fetchAttributesByIdentifier($identifierArray, $version = false, $languageArray = false, $asObject = true)

Parameters

$identifierArray
$version
$languageArray
$asObject

at line 706
public owner()

at line 718
public contentClassGroupIDList()

at line 729
public contentClassIdentifier()

at line 748
public contentClass()

at line 762
public remoteID()

at line 777
public mainParentNodeID()

at line 1099
public currentVersion($asObject = true)

Parameters

$asObject

at line 1107
public version($version, $asObject = true)

Parameters

$version
$asObject

at line 1140
public array versions(boolean $asObject = true, array $parameters = array())

Returns an array of eZContentObjectVersion for the current object according to the conditions in $parameters.

Parameters

boolean $asObject
array $parameters

Return Value

array

at line 1170
public hasRemainingVersions()

at line 1181
public createInitialVersion($userID, $initialLanguageCode = false)

Parameters

$userID
$initialLanguageCode

at line 1186
public createNewVersionIn($languageCode, $copyFromLanguageCode = false, $copyFromVersion = false, $versionCheck = true, $status = eZContentObjectVersion::STATUS_DRAFT)

Parameters

$languageCode
$copyFromLanguageCode
$copyFromVersion
$versionCheck
$status

at line 1200
public createNewVersion($copyFromVersion = false, $versionCheck = true, $languageCode = false, $copyFromLanguageCode = false, $status = eZContentObjectVersion::STATUS_DRAFT)

Parameters

$copyFromVersion
$versionCheck
$languageCode
$copyFromLanguageCode
$status

at line 1301
public copyVersion($newObject, $version, $newVersionNumber, $contentObjectID = false, $status = eZContentObjectVersion::STATUS_DRAFT, $languageCode = false, $copyFromLanguageCode = false)

Parameters

$newObject
$version
$newVersionNumber
$contentObjectID
$status
$languageCode
$copyFromLanguageCode

at line 1450
public __clone()

at line 1463
public copy($allVersions = true)

Parameters

$allVersions

at line 1565
public copyRevertTo($version, $language = false)

Parameters

$version
$language

at line 1606
public purge()

at line 1740
public removeThis($nodeID = null)

Parameters

$nodeID

at line 1822
public cleanupInternalDrafts($userID = false, $timeDuration = 86400)

Parameters

$userID
$timeDuration

at line 1891
public eZContentObjectAttribute[]|array|null allContentObjectAttributes(int $contentObjectID, bool $asObject = true, array|null $limit = null)

Fetches all attributes from any versions of the content object

Parameters

int $contentObjectID
bool $asObject
array|null $limit the limit array passed to eZPersistentObject::fetchObjectList

Return Value

eZContentObjectAttribute[]|array|null

at line 1907
public contentObjectAttributes($asObject = true, $version = false, $language = false, $contentObjectAttributeID = false, $distinctItemsOnly = false)

Parameters

$asObject
$version
$language
$contentObjectAttributeID
$distinctItemsOnly

at line 1992
public setContentObjectAttributes($attributes, $version, $language)

Parameters

$attributes
$version
$language

at line 2077
public resetInputRelationList()

at line 2083
public appendInputRelationList($addingIDList, $relationType)

Parameters

$addingIDList
$relationType

at line 2108
public commitInputRelations($editVersion)

Parameters

$editVersion

at line 2132
public validateInput($contentObjectAttributes, $attributeDataBaseName, $inputParameters = false, $parameters = array())

Parameters

$contentObjectAttributes
$attributeDataBaseName
$inputParameters
$parameters

at line 2255
public fixupInput($contentObjectAttributes, $attributeDataBaseName)

Parameters

$contentObjectAttributes
$attributeDataBaseName

at line 2264
public fetchInput($contentObjectAttributes, $attributeDataBaseName, $customActionAttributeArray, $customActionParameters)

Parameters

$contentObjectAttributes
$attributeDataBaseName
$customActionAttributeArray
$customActionParameters

at line 2323
public handleCustomHTTPActions($contentObjectAttribute, $attributeDataBaseName, $customActionAttributeArray, $customActionParameters)

Parameters

$contentObjectAttribute
$attributeDataBaseName
$customActionAttributeArray
$customActionParameters

at line 2339
public handleAllCustomHTTPActions($attributeDataBaseName, $customActionAttributeArray, $customActionParameters, $objectVersion = false)

Parameters

$attributeDataBaseName
$customActionAttributeArray
$customActionParameters
$objectVersion

at line 2389
public storeInput($contentObjectAttributes, $attributeInputMap)

Parameters

$contentObjectAttributes
$attributeInputMap

at line 2408
public nextVersion()

at line 2420
public previousVersion()

at line 2439
public getVersionCount()

at line 2448
public currentLanguage()

at line 2453
public currentLanguageObject()

at line 2467
public setCurrentLanguage($lang)

Parameters

$lang

at line 2473
public initialLanguage()

at line 2478
public initialLanguageCode()

at line 2492
public addLocation($parentNodeID, $asObject = false)

Parameters

$parentNodeID
$asObject

at line 2519
public addContentObjectRelation($toObjectID, $fromObjectVersion = false, $attributeID, $relationType = eZContentObject::RELATION_COMMON)

Parameters

$toObjectID
$fromObjectVersion
$attributeID
$relationType

at line 2600
public removeContentObjectRelation($toObjectID = false, $fromObjectVersion = false, $attributeID, $relationType = eZContentObject::RELATION_COMMON)

Parameters

$toObjectID
$fromObjectVersion
$attributeID
$relationType

at line 2673
public copyContentObjectRelations($currentVersion, $newVersion, $newObjectID = false)

Parameters

$currentVersion
$newVersion
$newObjectID

at line 2757
public relatedObjects($fromObjectVersion = false, $objectID = false, $attributeID, $groupByAttribute = false, $params = false, $reverseRelatedObjects = false)

Parameters

$fromObjectVersion
$objectID
$attributeID
$groupByAttribute
$params
$reverseRelatedObjects

at line 2971
public relatedContentObjectList($fromObjectVersion = false, $fromObjectID = false, $attributeID, $groupByAttribute = false, $params = false)

Parameters

$fromObjectVersion
$fromObjectID
$attributeID
$groupByAttribute
$params

at line 2984
public linkedContentObjectList($fromObjectVersion = false, $fromObjectID = false)

Parameters

$fromObjectVersion
$fromObjectID

at line 2996
public embeddedContentObjectList($fromObjectVersion = false, $fromObjectID = false)

Parameters

$fromObjectVersion
$fromObjectID

at line 3008
public reverseLinkedObjectList($fromObjectVersion = false, $fromObjectID = false)

Parameters

$fromObjectVersion
$fromObjectID

at line 3021
public reverseEmbeddedObjectList($fromObjectVersion = false, $fromObjectID = false)

Parameters

$fromObjectVersion
$fromObjectID

at line 3032
public relatedContentObjectArray($fromObjectVersion = false, $fromObjectID = false, $attributeID, $params = false)

Parameters

$fromObjectVersion
$fromObjectID
$attributeID
$params

at line 3061
public relatedContentObjectCount($fromObjectVersion = false, $attributeID, $params = false)

Parameters

$fromObjectVersion
$attributeID
$params

at line 3092
public reverseRelatedObjectList($version = false, $attributeID, $groupByAttribute = false, $params = false)

Parameters

$version
$attributeID
$groupByAttribute
$params

at line 3103
public linkedContentObjectCount($fromObjectVersion = false)

Parameters

$fromObjectVersion

at line 3114
public embeddedContentObjectCount($fromObjectVersion = false)

Parameters

$fromObjectVersion

at line 3125
public reverseLinkedObjectCount($fromObjectVersion = false)

Parameters

$fromObjectVersion

at line 3136
public reverseEmbeddedObjectCount($fromObjectVersion = false)

Parameters

$fromObjectVersion

at line 3171
public int relatedObjectCount(int $version = false, int $attributeID, int|false $reverseRelatedObjects = false, array|false $params = false)

Fetch the number of (reverse) related objects

Parameters

int $version
int $attributeID This parameter only makes sense if $params[AllRelations] is unset, set to false, or matches eZContentObject::RELATION_ATTRIBUTE Possible values: - 0 or false: Count relations made with any attribute - >0 Count relations made with attribute $attributeID
int|false $reverseRelatedObjects Wether to count related objects (false) or reverse related objects (false)
array|false $params Various params, as an associative array. Possible values: - AllRelations (bool|int) true: count ALL relations, object and attribute level false: only count object level relations other: bit mask of eZContentObject::RELATION_* constants - IgnoreVisibility (bool) If true, 'hidden' status will be ignored

Return Value

int The number of (reverse) related objects for the object

at line 3274
public reverseRelatedObjectCount($version = false, $attributeID, $params = false)

Parameters

$version
$attributeID
$params

at line 3283
public contentObjectListRelatingThis($version = false)

Parameters

$version

at line 3291
public parentNodeIDArray()

at line 3301
public parentNodes($version = false, $asObject = true)

Parameters

$version
$asObject

at line 3340
public createNodeAssignment($parentNodeID, $isMain, $remoteID = false, $sortField = eZContentObjectTreeNode::SORT_FIELD_PUBLISHED, $sortOrder = eZContentObjectTreeNode::SORT_ORDER_DESC)

Parameters

$parentNodeID
$isMain
$remoteID
$sortField
$sortOrder

at line 3388
public assignedNodes($asObject = true)

Parameters

$asObject

at line 3422
public mainNodeID()

at line 3432
public mainNode()

at line 3440
public setPermissions($permissionArray)

Parameters

$permissionArray

at line 3448
public permissions()

at line 3453
public canEditLanguages()

at line 3471
public canCreateLanguages()

at line 3488
public checkGroupLimitationAccess($limitationValueList, $userID, $contentObjectID = false)

Parameters

$limitationValueList
$userID
$contentObjectID

at line 3546
public checkAccess($functionName, $originalClassID = false, $parentClassID = false, $returnAccessList = false, $language = false)

Parameters

$functionName
$originalClassID
$parentClassID
$returnAccessList
$language

at line 4102
public classListFromPolicy($policy, $allowedLanguageCodes = false)

Parameters

$policy
$allowedLanguageCodes

at line 4280
public canCreateClassList($asObject = false, $includeFilter = true, $groupList = false, $fetchID = false)

Parameters

$asObject
$includeFilter
$groupList
$fetchID

at line 4422
public accessList($function)

Parameters

$function

at line 4442
public canRead()

at line 4454
public canPdf()

at line 4467
public canViewEmbed()

at line 4479
public canDiff()

at line 4488
public canCreate()

at line 4497
public canEdit($originalClassID = false, $parentClassID = false, $returnAccessList = false, $language = false)

Parameters

$originalClassID
$parentClassID
$returnAccessList
$language

at line 4528
public canTranslate()

at line 4549
public canRemove()

at line 4564
public canMoveFrom()

at line 4579
public className()

at line 4604
public contentActionList()

at line 4640
public hasContentAction($name)

Parameters

$name

at line 4663
public availableLanguages()

at line 4676
public availableLanguagesJsArray()

at line 4681
public languages()

at line 4688
public allLanguages()

at line 4734
public setClassName($name)

Parameters

$name

at line 4780
public fetchClassAttributes($version, $asObject = true)

Parameters

$version
$asObject

at line 5135
public postUnserialize($package)

Parameters

$package

at line 5155
public serialize($package, $specificVersion = false, $options = false, $contentNodeIDArray = false, $topNodeIDArray = false)

Parameters

$package
$specificVersion
$options
$contentNodeIDArray
$topNodeIDArray

at line 5253
public cacheInfo($Params)

Parameters

$Params

at line 5372
public authorArray()

at line 5422
public rename($newName)

Parameters

$newName

at line 5504
public removeTranslation($languageID)

Parameters

$languageID

at line 5622
public isAlwaysAvailable()

at line 5627
public setAlwaysAvailableLanguageID($languageID, $version = false)

Parameters

$languageID
$version

at line 5686
public allowedAssignSectionList()

at line 5710
public array allowedAssignStateIDList(eZUser $user = null)

Gets a list of states a user is allowed to put the content object in.

Parameters

eZUser $user the user to check the policies of, when omitted the currently logged in user will be used

Return Value

array the IDs of all states we are allowed to set

at line 5823
public allowedAssignStateList(eZUser $user = null)

Parameters

eZUser $user

at line 5871
public array stateIDArray(boolean $refreshCache = false)

Gets the current states of the content object.

Uses a member variable that caches the result.

Parameters

boolean $refreshCache if the cache in the member variable needs to be refreshed

Return Value

array an associative array with state group id => state id pairs

at line 5896
public stateIdentifierArray()

at line 5927
public boolean assignState(eZContentObjectState $state)

Sets the state of a content object.

Changes are stored immediately in the database, does not require a store() of the content object. Should only be called on instances of eZContentObject that have a ID (that were stored already before).

Parameters

eZContentObjectState $state

Return Value

boolean true when the state was set, false if the state equals the current state

at line 5958
public assignDefaultStates()

Sets the default states of a content object.

This function is called upon instantiating a content object with {@link eZContentClass::instantiate()}, so should normally not be called by any other code.

at line 5976
public restoreObjectAttributes()

Restores attributes for current content object when it's being restored from trash

at line 6000
public string sectionIdentifier()

Returns object's section identifier

Return Value

string