kernel/classes/ezcontentobject.php
File containing the eZContentObject class.
- Copyright
- Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
- License
- eZ Business Use License Agreement Version 2.0
- Package
- kernel
- Version
- 4.6.0
\eZContentObject
File containing the eZContentObject class.
- Parent(s)
- \eZPersistentObject
- Copyright
- Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
- License
- eZ Business Use License Agreement Version 2.0
- Version
- 4.6.0
Constants
Properties

$PersistentDataDirty= ''
- Type
- n/a
- Inherited_from
- \eZPersistentObject::$$PersistentDataDirty

array
$StateIDArray= 'false'
Cache for the state ID array
falseDetails- Type
- array
- See
- \eZContentObject::stateIDArray()
Methods

addContentObjectRelation(
$toObjectID, $fromObjectVersion
=
false, $attributeID
=
0, $relationType
=
eZContentObject::RELATION_COMMON
)
:
void| Name | Type | Description |
|---|---|---|
| $toObjectID | ||
| $fromObjectVersion | ||
| $attributeID | ||
| $relationType |

addLocation(
$parentNodeID, $asObject
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $parentNodeID | ||
| $asObject |

allContentObjectAttributes(
$contentObjectID, $asObject
=
true
)
:
void| Name | Type | Description |
|---|---|---|
| $contentObjectID | ||
| $asObject |

allowedAssignStateIDList(
\eZUser $user
=
null
)
:
arrayGets a list of states a user is allowed to put the content object in.
| Name | Type | Description |
|---|---|---|
| $user | \eZUser | the user to check the policies of, when omitted the currently logged in user will be used |
| Type | Description |
|---|---|
| array | the IDs of all states we are allowed to set |

appendInputRelationList(
$addingIDList, $relationType
)
:
void| Name | Type | Description |
|---|---|---|
| $addingIDList | ||
| $relationType |

assignDefaultStates(
)
:
voidSets 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.

assignState(
\eZContentObjectState $state
)
:
booleanSets 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).
| Name | Type | Description |
|---|---|---|
| $state | \eZContentObjectState |
| Type | Description |
|---|---|
| boolean | true when the state was set, false if the state equals the current state |

attribute(
$attr, $noFunction
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $attr | ||
| $noFunction |

canCreateClassList(
$asObject
=
false, $includeFilter
=
true, $groupList
=
false, $fetchID
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $asObject | ||
| $includeFilter | ||
| $groupList | ||
| $fetchID |

canEdit(
$originalClassID
=
false, $parentClassID
=
false, $returnAccessList
=
false, $language
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $originalClassID | ||
| $parentClassID | ||
| $returnAccessList | ||
| $language |

checkAccess(
$functionName, $originalClassID
=
false, $parentClassID
=
false, $returnAccessList
=
false, $language
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $functionName | ||
| $originalClassID | ||
| $parentClassID | ||
| $returnAccessList | ||
| $language |

checkGroupLimitationAccess(
$limitationValueList, $userID, $contentObjectID
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $limitationValueList | ||
| $userID | ||
| $contentObjectID |

classListFromPolicy(
$policy, $allowedLanguageCodes
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $policy | ||
| $allowedLanguageCodes |

cleanupAllInternalDrafts(
$userID
=
false, $timeDuration
=
86400
)
:
void| Name | Type | Description |
|---|---|---|
| $userID | ||
| $timeDuration |

cleanupInternalDrafts(
$userID
=
false, $timeDuration
=
86400
)
:
void| Name | Type | Description |
|---|---|---|
| $userID | ||
| $timeDuration |

contentObjectAttributes(
$asObject
=
true, $version
=
false, $language
=
false, $contentObjectAttributeID
=
false, $distinctItemsOnly
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $asObject | ||
| $version | ||
| $language | ||
| $contentObjectAttributeID | ||
| $distinctItemsOnly |

copyContentObjectRelations(
$currentVersion, $newVersion, $newObjectID
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $currentVersion | ||
| $newVersion | ||
| $newObjectID |

copyRevertTo(
$version, $language
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $version | ||
| $language |

copyVersion(
$newObject, $version, $newVersionNumber, $contentObjectID
=
false, $status
=
eZContentObjectVersion::STATUS_DRAFT, $languageCode
=
false, $copyFromLanguageCode
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $newObject | ||
| $version | ||
| $newVersionNumber | ||
| $contentObjectID | ||
| $status | ||
| $languageCode | ||
| $copyFromLanguageCode |

count(
$def, $conds
=
null, $field
=
null
)
:
void
| Name | Type | Description |
|---|---|---|
| $def | ||
| $conds | ||
| $field |

create(
$name, $contentclassID, $userID, $sectionID
=
1, $version
=
1, $languageCode
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $name | ||
| $contentclassID | ||
| $userID | ||
| $sectionID | ||
| $version | ||
| $languageCode |

createFilterByVisibilitySQLString(
bool $IgnoreVisibility
=
false, string $ezcontentobjectTable
=
'ezcontentobject'
)
:
stringCreates the SQL for filtering objects by visibility, used by IgnoreVisibility on some fetches.
The object is visible if 1 or more assigned nodes are visible.
| Name | Type | Description |
|---|---|---|
| $IgnoreVisibility | bool | ignores visibility if true |
| $ezcontentobjectTable | string | name of ezcontentobject table used in sql |
| Type | Description |
|---|---|
| string | with sql condition for node filtering by visibility |
- Since
- Version 4.1
- Static

createGroupedDataMap(
array $contentObjectAttributes
)
:
arrayGenerates a map with all the content object attributes where the keys are the attribute identifiers grouped by class attribute category.
| Name | Type | Description |
|---|---|---|
| $contentObjectAttributes | array | Array of eZContentObjectAttribute objects |
| Type | Description |
|---|---|
| array |
- Note
- Result is not cached, so make sure you don't call this over and over.

createInitialVersion(
$userID, $initialLanguageCode
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $userID | ||
| $initialLanguageCode |

createNewVersion(
$copyFromVersion
=
false, $versionCheck
=
true, $languageCode
=
false, $copyFromLanguageCode
=
false, $status
=
eZContentObjectVersion::STATUS_DRAFT
)
:
void| Name | Type | Description |
|---|---|---|
| $copyFromVersion | ||
| $versionCheck | ||
| $languageCode | ||
| $copyFromLanguageCode | ||
| $status |

createNewVersionIn(
$languageCode, $copyFromLanguageCode
=
false, $copyFromVersion
=
false, $versionCheck
=
true, $status
=
eZContentObjectVersion::STATUS_DRAFT
)
:
void| Name | Type | Description |
|---|---|---|
| $languageCode | ||
| $copyFromLanguageCode | ||
| $copyFromVersion | ||
| $versionCheck | ||
| $status |

createNodeAssignment(
$parentNodeID, $isMain, $remoteID
=
false, $sortField
=
eZContentObjectTreeNode::SORT_FIELD_PUBLISHED, $sortOrder
=
eZContentObjectTreeNode::SORT_ORDER_DESC
)
:
void| Name | Type | Description |
|---|---|---|
| $parentNodeID | ||
| $isMain | ||
| $remoteID | ||
| $sortField | ||
| $sortOrder |

createWithNodeAssignment(
$parentNode, $contentClassID, $languageCode, $remoteID
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $parentNode | ||
| $contentClassID | ||
| $languageCode | ||
| $remoteID |

eZPersistentObject(
$row
)
:
void| Name | Type | Description |
|---|---|---|
| $row |

embeddedContentObjectCount(
$fromObjectVersion
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $fromObjectVersion |

embeddedContentObjectList(
$fromObjectVersion
=
false, $fromObjectID
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $fromObjectVersion | ||
| $fromObjectID |

fetch(
int $id, bool $asObject
=
true
)
:
\eZContentObjectFetches a content object by ID
| Name | Type | Description |
|---|---|---|
| $id | int | ID of the content object to fetch |
| $asObject | bool | Return the result as an object (true) or an assoc. array (false) |
| Type | Description |
|---|---|
| \eZContentObject |

fetchAttributesByIdentifier(
$identifierArray, $version
=
false, $languageArray
=
false, $asObject
=
true
)
:
void| Name | Type | Description |
|---|---|---|
| $identifierArray | ||
| $version | ||
| $languageArray | ||
| $asObject |

fetchByNodeID(
int | array $nodeID, bool $asObject
=
true
)
:
mixedFetches the contentobject which has a node with ID $nodeID $nodeID can also be an array of NodeIDs. In this case, an array of content objects will be returned
| Name | Type | Description |
|---|---|---|
| $nodeID | int | array | Single nodeID or array of NodeIDs |
| $asObject | bool | If results have to be returned as eZContentObject instances or not |
| Type | Description |
|---|---|
| mixed | Content object or array of content objects. Content objects can be eZContentObject instances or array result sets |

fetchByRemoteID(
$remoteID, $asObject
=
true
)
:
void| Name | Type | Description |
|---|---|---|
| $remoteID | ||
| $asObject |

fetchClassAttributes(
$version
=
0, $asObject
=
true
)
:
void| Name | Type | Description |
|---|---|---|
| $version | ||
| $asObject |

fetchDataMap(
$version
=
false, $language
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $version | ||
| $language |

fetchFilteredList(
$conditions
=
null, $offset
=
false, $limit
=
false, $asObject
=
true
)
:
void| Name | Type | Description |
|---|---|---|
| $conditions | ||
| $offset | ||
| $limit | ||
| $asObject |

fetchIDArray(
array $idArray, bool $asObject
=
true
)
:
\array(contentObjectIDFetches a content object list based on an array of content object ids
| Name | Type | Description |
|---|---|---|
| $idArray | array | array of content object ids |
| $asObject | bool | Wether to get the result as an array of eZContentObject or an array of associative arrays |
| Type | Description |
|---|---|
| \array(contentObjectID | => eZContentObject|array) array of eZContentObject (if $asObject = true) or array of associative arrays (if $asObject = false) |

fetchInput(
$contentObjectAttributes, $attributeDataBaseName, $customActionAttributeArray, $customActionParameters
)
:
void| Name | Type | Description |
|---|---|---|
| $contentObjectAttributes | ||
| $attributeDataBaseName | ||
| $customActionAttributeArray | ||
| $customActionParameters |

fetchList(
$asObject
=
true, $conditions
=
null, $offset
=
false, $limit
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $asObject | ||
| $conditions | ||
| $offset | ||
| $limit |

fetchObject(
$def, $field_filters, $conds, $asObject
=
true, $grouping
=
null, $custom_fields
=
null
)
:
void
| Name | Type | Description |
|---|---|---|
| $def | ||
| $field_filters | ||
| $conds | ||
| $asObject | ||
| $grouping | ||
| $custom_fields |

fetchObjectCountByUserID(
$classID, $userID, $status
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $classID | ||
| $userID | ||
| $status |

fetchObjectList(
$def, $field_filters
=
null, $conds
=
null, $sorts
=
null, $limit
=
null, $asObject
=
true, $grouping
=
false, $custom_fields
=
null, $custom_tables
=
null, $custom_conds
=
null
)
:
void
| Name | Type | Description |
|---|---|---|
| $def | ||
| $field_filters | ||
| $conds | ||
| $sorts | ||
| $limit | ||
| $asObject | ||
| $grouping | ||
| $custom_fields | ||
| $custom_tables | ||
| $custom_conds |

fetchSameClassList(
$contentClassID, $asObject
=
true, $offset
=
false, $limit
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $contentClassID | ||
| $asObject | ||
| $offset | ||
| $limit |

fetchSameClassListCount(
$contentClassID
)
:
void| Name | Type | Description |
|---|---|---|
| $contentClassID |

fill(
$row
)
:
void| Name | Type | Description |
|---|---|---|
| $row |

fillNodeListAttributes(
$objList, $asObject
=
true
)
:
void| Name | Type | Description |
|---|---|---|
| $objList | ||
| $asObject |

fixReverseRelations(
$objectID, $mode
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $objectID | ||
| $mode |

fixupInput(
$contentObjectAttributes, $attributeDataBaseName
)
:
void| Name | Type | Description |
|---|---|---|
| $contentObjectAttributes | ||
| $attributeDataBaseName |

getShortAttributeName(
$db, $def, $attrName
)
:
void
| Name | Type | Description |
|---|---|---|
| $db | ||
| $def | ||
| $attrName |

groupedDataMap(
)
:
arrayGenerates a map with all the content object attributes where the keys are the attribute identifiers grouped by class attribute category.
| Type | Description |
|---|---|
| array |
- Note
- Result is not cached, so make sure you don't call this over and over.

handleAllCustomHTTPActions(
$attributeDataBaseName, $customActionAttributeArray, $customActionParameters, $objectVersion
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $attributeDataBaseName | ||
| $customActionAttributeArray | ||
| $customActionParameters | ||
| $objectVersion |

handleCustomHTTPActions(
$contentObjectAttribute, $attributeDataBaseName, $customActionAttributeArray, $customActionParameters
)
:
void| Name | Type | Description |
|---|---|---|
| $contentObjectAttribute | ||
| $attributeDataBaseName | ||
| $customActionAttributeArray | ||
| $customActionParameters |

handleRows(
$rows, $class_name, $asObject
)
:
void
| Name | Type | Description |
|---|---|---|
| $rows | ||
| $class_name | ||
| $asObject |

hasAttribute(
$attr
)
:
void| Name | Type | Description |
|---|---|---|
| $attr |

isComplexViewModeCacheExpired(
$viewMode, $timestamp
)
:
void| Name | Type | Description |
|---|---|---|
| $viewMode | ||
| $timestamp |

linkedContentObjectCount(
$fromObjectVersion
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $fromObjectVersion |

linkedContentObjectList(
$fromObjectVersion
=
false, $fromObjectID
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $fromObjectVersion | ||
| $fromObjectID |

mapLanguage(
$language, $options
)
:
void| Name | Type | Description |
|---|---|---|
| $language | ||
| $options |

newObjectOrder(
$def, $orderField, $conditions
)
:
void
| Name | Type | Description |
|---|---|---|
| $def | ||
| $orderField | ||
| $conditions |

parentNodes(
$version
=
false, $asObject
=
true
)
:
void| Name | Type | Description |
|---|---|---|
| $version | ||
| $asObject |

relatedContentObjectArray(
$fromObjectVersion
=
false, $fromObjectID
=
false, $attributeID
=
0, $params
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $fromObjectVersion | ||
| $fromObjectID | ||
| $attributeID | ||
| $params |

relatedContentObjectCount(
$fromObjectVersion
=
false, $attributeID
=
0, $params
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $fromObjectVersion | ||
| $attributeID | ||
| $params |

relatedContentObjectList(
$fromObjectVersion
=
false, $fromObjectID
=
false, $attributeID
=
0, $groupByAttribute
=
false, $params
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $fromObjectVersion | ||
| $fromObjectID | ||
| $attributeID | ||
| $groupByAttribute | ||
| $params |

relatedObjectCount(
int $version
=
false, int $attributeID
=
0, int | false $reverseRelatedObjects
=
false, array | false $params
=
false
)
:
intFetch the number of (reverse) related objects
| Name | Type | Description |
|---|---|---|
| $version | int | |
| $attributeID | int | 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 |
| $reverseRelatedObjects | int | false | Wether to count related objects (false) or reverse related objects (false) |
| $params | array | false | 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 |
| Type | Description |
|---|---|
| int | The number of (reverse) related objects for the object |

relatedObjects(
$fromObjectVersion
=
false, $objectID
=
false, $attributeID
=
0, $groupByAttribute
=
false, $params
=
false, $reverseRelatedObjects
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $fromObjectVersion | ||
| $objectID | ||
| $attributeID | ||
| $groupByAttribute | ||
| $params | ||
| $reverseRelatedObjects |

relationTypeMask(
$allRelations
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $allRelations |

remove(
$conditions
=
null, $extraConditions
=
null
)
:
void| Name | Type | Description |
|---|---|---|
| $conditions | ||
| $extraConditions |

removeContentObjectRelation(
$toObjectID
=
false, $fromObjectVersion
=
false, $attributeID
=
0, $relationType
=
eZContentObject::RELATION_COMMON
)
:
void| Name | Type | Description |
|---|---|---|
| $toObjectID | ||
| $fromObjectVersion | ||
| $attributeID | ||
| $relationType |

removeObject(
$def, $conditions
=
null, $extraConditions
=
null
)
:
void
| Name | Type | Description |
|---|---|---|
| $def | ||
| $conditions | ||
| $extraConditions |

removeVersions(
$versionStatus
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $versionStatus |

reorderObject(
$def, $orderField, $conditions, $down
=
true
)
:
void
| Name | Type | Description |
|---|---|---|
| $def | ||
| $orderField | ||
| $conditions | ||
| $down |

replaceFieldsWithShortNames(
$db, $fieldDefs, $fields
)
:
void
| Name | Type | Description |
|---|---|---|
| $db | ||
| $fieldDefs | ||
| $fields |

restoreObjectAttributes(
)
:
voidRestores attributes for current content object when it's being restored from trash

reverseEmbeddedObjectCount(
$fromObjectVersion
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $fromObjectVersion |

reverseEmbeddedObjectList(
$fromObjectVersion
=
false, $fromObjectID
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $fromObjectVersion | ||
| $fromObjectID |

reverseLinkedObjectCount(
$fromObjectVersion
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $fromObjectVersion |

reverseLinkedObjectList(
$fromObjectVersion
=
false, $fromObjectID
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $fromObjectVersion | ||
| $fromObjectID |

reverseRelatedObjectCount(
$version
=
false, $attributeID
=
0, $params
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $version | ||
| $attributeID | ||
| $params |

reverseRelatedObjectList(
$version
=
false, $attributeID
=
0, $groupByAttribute
=
false, $params
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $version | ||
| $attributeID | ||
| $groupByAttribute | ||
| $params |

serialize(
$package, $specificVersion
=
false, $options
=
false, $contentNodeIDArray
=
false, $topNodeIDArray
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $package | ||
| $specificVersion | ||
| $options | ||
| $contentNodeIDArray | ||
| $topNodeIDArray |

setAlwaysAvailableLanguageID(
$languageID, $version
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $languageID | ||
| $version |

setAttribute(
$attr, $val
)
:
void| Name | Type | Description |
|---|---|---|
| $attr | ||
| $val |

setContentObjectAttributes(
$attributes, $version, $language
)
:
void| Name | Type | Description |
|---|---|---|
| $attributes | ||
| $version | ||
| $language |

setHasDirtyData(
$hasDirtyData
)
:
void| Name | Type | Description |
|---|---|---|
| $hasDirtyData |

setName(
$objectName, $versionNum
=
false, $languageCode
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $objectName | ||
| $versionNum | ||
| $languageCode |

stateIDArray(
boolean $refreshCache
=
false
)
:
arrayGets the current states of the content object.
Uses a member variable that caches the result.
| Name | Type | Description |
|---|---|---|
| $refreshCache | boolean | if the cache in the member variable needs to be refreshed |
| Type | Description |
|---|---|
| array | an associative array with state group id => state id pairs |

storeInput(
$contentObjectAttributes, $attributeInputMap
)
:
void| Name | Type | Description |
|---|---|---|
| $contentObjectAttributes | ||
| $attributeInputMap |

storeObject(
$obj, $fieldFilters
=
null
)
:
void
| Name | Type | Description |
|---|---|---|
| $obj | ||
| $fieldFilters |

swapRow(
$table, $keys, $order_id, $rows, $id1, $id2
)
:
void
| Name | Type | Description |
|---|---|---|
| $table | ||
| $keys | ||
| $order_id | ||
| $rows | ||
| $id1 | ||
| $id2 |

sync(
$fieldFilters
=
null
)
:
void| Name | Type | Description |
|---|---|---|
| $fieldFilters |

unserialize(
$package, $domNode, $options, $ownerID
=
false, $handlerType
=
'ezcontentobject'
)
:
void| Name | Type | Description |
|---|---|---|
| $package | ||
| $domNode | ||
| $options | ||
| $ownerID | ||
| $handlerType |

validateInput(
$contentObjectAttributes, $attributeDataBaseName, $inputParameters
=
false, $parameters
=
array()
)
:
void| Name | Type | Description |
|---|---|---|
| $contentObjectAttributes | ||
| $attributeDataBaseName | ||
| $inputParameters | ||
| $parameters |

versionLanguageName(
$version, $lang
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $version | ||
| $lang |