Class

eZContentObject

class eZContentObject extends eZPersistentObject

Encapsulates data about and methods to work with content objects

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.
int $ID
string $Name
bool|string $CurrentLanguage
bool|string $ClassName
string $ClassIdentifier
eZContentObjectAttribute[] $DataMap
array|bool $ContentActionList
eZContentObjectAttribute[] $ContentObjectAttributes
int|bool $MainNodeID
array $InputRelationList

Methods

__construct(int|array $row)

Initializes the object with $row.

eZPersistentObject(int|array $row = null)

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 $fieldFilters = null)

Stores the object

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
array|bool matchIngroupIDList()

Get class groups this object's class belongs to if match for class groups is enabled, otherwise false

storeNodeModified()

Update all nodes to set modified_subnode value

bool|string name(int|bool $version = false, bool $lang = false)

Returns an object's name for the version given by $version in the language given by $lang

string[] names()

Returns all translations of the current object's name

string|bool versionLanguageName(int $version, string|bool $lang = false)

Returns the object name for version $version in the language $lang

setCachedName(string $name)

Sets the name of the object, in memory only.

setName(string $objectName, int|bool $versionNum = false, int|bool $languageCode = false)

Sets the name of the object in all translations.

eZContentObjectAttribute[] dataMap()

Return a map with all the content object attributes where the keys are the attribute identifiers.

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(eZContentObjectAttribute[] $contentObjectAttributes)

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

eZContentObjectAttribute[] fetchDataMap(int|bool $version = false, string|bool $language = false)

Returns a map with all the content object attributes where the keys are the attribute identifiers.

array resetDataMap()

Resets (empties) the current object's data map

eZContentObjectAttribute[]|array|null fetchAttributesByIdentifier(string[] $identifierArray, int|bool $version = false, string[]|bool $languageArray = false, bool $asObject = true)

Fetches a set of content object attributes by their class identifiers.

eZContentObject|null owner()

Returns the owner of the object as a content object.

array contentClassGroupIDList()

Returns the content class group identifiers for the current content object

string|bool|null contentClassIdentifier()

Returns the content class identifer for the current content object

eZContentClass|null contentClass()

Returns the content class for the current content object

string remoteID()

Returns the remote id of the current content object

int|null mainParentNodeID()

Returns the ID of the the current object's main node

eZContentObjectVersion|array|bool currentVersion(bool $asObject = true)

Returns the current version of this document.

int|null publishedVersion()

Returns the published version of the object, or null if not published yet.

eZContentObjectVersion|array|bool version(int $version, bool $asObject = true)

Returns the given object version.

eZContentObjectVersion[]|array versions(bool $asObject = true, array $parameters = array())

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

bool hasRemainingVersions()

Returns true if the object has any versions remaining.

eZContentObjectVersion createInitialVersion(int $userID, string|bool $initialLanguageCode = false)

Creates an initial content object version

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

Creates a new version for the language $languageCode

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

Creates a new version and returns it as an eZContentObjectVersion object.

eZContentObjectVersion copyVersion(eZContentObject $newObject, eZContentObjectVersion $version, int $newVersionNumber, int|bool $contentObjectID = false, int $status = eZContentObjectVersion::STATUS_DRAFT, string|bool $languageCode = false, string|bool $copyFromLanguageCode = false)

Creates a new version and returns it as an eZContentObjectVersion object.

__clone()

Resets certain attributes of the content object on clone and resets the data map

eZContentObject copy(bool $allVersions = true)

Makes a copy of the object which is stored and then returns it.

int copyRevertTo(int $version, string|bool $language = false)

Copies the given version of the object and creates a new current version.

purge()

Deletes the current object, all versions and translations, and corresponding tree nodes from the database

removeThis(int $nodeID = null)

Archives the current object and removes assigned nodes

cleanupInternalDrafts(int|bool $userID = false, int $timeDuration = 86400)

Removes old internal drafts by the specified user associated for the past time span given by $timeDuration

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

Fetches all attributes from any versions of the content object

eZContentObjectAttribute[]|array contentObjectAttributes(bool $asObject = true, int|bool $version = false, string|bool $language = false, int|bool $contentObjectAttributeID = false, bool $distinctItemsOnly = false)

Fetches the attributes for the current published version of the object.

setContentObjectAttributes(eZContentObjectAttribute[] $attributes, int $version, string $language)

Initializes the cached copy of the content object attributes for the given version and language

resetInputRelationList()

Resets the object's input relation list

appendInputRelationList(int[] $addingIDList, int $relationType)

bool commitInputRelations(int|bool $editVersion)

array validateInput(eZContentObjectAttribute[] $contentObjectAttributes, string $attributeDataBaseName, array|bool $inputParameters = false, array $parameters = array())

fixupInput(eZContentObjectAttribute[] $contentObjectAttributes, string $attributeDataBaseName)

array fetchInput(eZContentObjectAttribute[] $contentObjectAttributes, string $attributeDataBaseName, array $customActionAttributeArray, array $customActionParameters)

handleCustomHTTPActions(eZContentObjectAttribute $contentObjectAttribute, string $attributeDataBaseName, array $customActionAttributeArray, array $customActionParameters)

handleAllCustomHTTPActions(string $attributeDataBaseName, array $customActionAttributeArray, array $customActionParameters, int|bool $objectVersion = false)

storeInput(eZContentObjectAttribute[] $contentObjectAttributes, array $attributeInputMap)

Transaction unsafe.

int nextVersion()

Returns the next available version number for this object.

int|bool previousVersion()

Returns the previous available version number for this object, if existing, false otherwise ( if the object has only one version )

mixed getVersionCount()

Returns the number of existing versions.

bool|string currentLanguage()

Returns the current object's language

eZContentLanguage|bool| currentLanguageObject()

Returns the language object of the current object's language

setCurrentLanguage(string $lang)

Sets the current object's language and resets the name

eZContentLanguage|bool initialLanguage()

Returns the current object's initial language object, or false if not set

string|bool initialLanguageCode()

Returns the current object's initial language code, or false if not set

eZContentObjectTreeNode|int addLocation(int $parentNodeID, bool $asObject = false)

Adds a new location (node) to the current object.

bool|void addContentObjectRelation(int $toObjectID, int|bool $fromObjectVersion = false, int $attributeID, int $relationType = eZContentObject::RELATION_COMMON)

Adds a link to the given content object id.

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

Removes a link to the given content object id.

copyContentObjectRelations(int $currentVersion, int $newVersion, int|bool $newObjectID = false)

eZContentObject[]|array relatedObjects(int|bool $fromObjectVersion = false, int|bool $objectID = false, int|bool $attributeID, bool $groupByAttribute = false, array|bool $params = false, bool $reverseRelatedObjects = false)

Returns related or reverse related objects

array|eZContentObject[] relatedContentObjectList(int|bool $fromObjectVersion = false, int|bool $fromObjectID = false, int|bool $attributeID, bool $groupByAttribute = false, array|bool $params = false)

Returns related objects.

array|eZContentObject[] linkedContentObjectList(int|bool $fromObjectVersion = false, int|bool $fromObjectID = false)

Returns the xml-linked objects.

array|eZContentObject[] embeddedContentObjectList(int|bool $fromObjectVersion = false, int|bool $fromObjectID = false)

Returns the xml-embedded objects.

array|eZContentObject[] reverseLinkedObjectList(int|bool $fromObjectVersion = false, int|bool $fromObjectID = false)

Returns the reverse xml-linked objects.

array|eZContentObject[] reverseEmbeddedObjectList(int|bool $fromObjectVersion = false, int|bool $fromObjectID = false)

Returns the reverse xml-embedded objects.

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

Left for compatibility

int relatedContentObjectCount(int|bool $fromObjectVersion = false, int|bool $attributeID, array|bool $params = false)

Returns the number of related objects

array|eZContentObject[] reverseRelatedObjectList(int|bool $version = false, int|bool $attributeID, bool $groupByAttribute = false, array|bool $params = false)

Returns the objects to which this object are related .

int linkedContentObjectCount(int|bool $fromObjectVersion = false)

Returns the xml-linked objects count.

int embeddedContentObjectCount(int|bool $fromObjectVersion = false)

Returns the xml-embedded objects count.

int reverseLinkedObjectCount(int|bool $fromObjectVersion = false)

Returns the reverse xml-linked objects count.

int reverseEmbeddedObjectCount(int|bool $fromObjectVersion = false)

Returns the reverse xml-embedded objects count.

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

Fetch the number of (reverse) related objects

int reverseRelatedObjectCount(int|bool $version = false, int|bool $attributeID, array|bool $params = false)

Returns the number of objects to which this object is related.

array|eZContentObject[] contentObjectListRelatingThis(int|bool $version = false)

Returns the related objects.

int[] parentNodeIDArray()

Returns an array of parent node IDs

eZContentObjectTreeNode[]|int[] parentNodes(int|bool $version = false, bool $asObject = true)

Returns the parent nodes for the current object.

eZNodeAssignment|null createNodeAssignment(int $parentNodeID, bool $isMain, string|bool $remoteID = false, int $sortField = eZContentObjectTreeNode::SORT_FIELD_PUBLISHED, int $sortOrder = eZContentObjectTreeNode::SORT_ORDER_DESC)

Creates and returns a new node assignment that will place the object as child of node $nodeID.

eZContentObjectTreeNode[] visibleNodes()

Returns the visible nodes of the current object.

boolean hasVisibleNode()

Returns whether the current object has at least one visible node.

eZContentObjectTreeNode[]|array[] assignedNodes(boolean $asObject = true, boolean $checkVisibility = false)

Returns the node assignments for the current object.

int|null mainNodeID()

Returns the main node id for the current object and sets the attribute MainNodeID in the current object

int|null mainNode()

Returns the main node id for the current object.

setPermissions(array $permissionArray)

Sets the permissions for this object.

array permissions()

Returns the permission for the current object.

eZContentLanguage[] canEditLanguages()

Returns a list of languages of the current object that the current user can edit

eZContentLanguage[] canCreateLanguages()

Returns a list of languages of the current object that the current user can create

string checkGroupLimitationAccess(array $limitationValueList, int $userID, int|bool $contentObjectID = false)

array|int checkAccess(string $functionName, int|bool $originalClassID = false, int|bool $parentClassID = false, bool $returnAccessList = false, string|bool $language = false)

Check access for the current object

array classListFromPolicy(array $policy, array|bool $allowedLanguageCodes = false)

Returns an array of classes the current user has access to

array|eZPersistentObject[] canCreateClassList(bool $asObject = false, bool $includeFilter = true, bool $groupList = false, bool $fetchID = false)

Finds all classes that the current user can create objects from and returns.

array|int accessList(string $function)

Get accesslist for specified function

bool canRead()

Returns true if the current user can read this content object.

bool canPdf()

Returns true if the current user can create a pdf of this content object.

bool canViewEmbed()

Returns true if the node can be viewed as embeded object by the current user.

bool canDiff()

Returns true if the current user can diff this content object.

bool canCreate()

Returns true if the current user can create a content object like this one.

bool canEdit(int|bool $originalClassID = false, int|bool $parentClassID = false, bool $returnAccessList = false, string|bool $language = false)

Returns true if the current user can edit this content object.

bool canTranslate()

Returns true if the current user can translate this content object.

bool canRemove()

Returns true if the current user can remove this content object.

bool canMoveFrom()

Returns true if the current user can move this content object.

string|bool|null className()

Returns the name of the class which this object was created from.

array|bool contentActionList()

Returns an array of the content actions which can be performed on the current object.

bool hasContentAction(string $name)

Returns true if the given content action is in the content action list

array availableLanguages()

Returns the languages the object has been translated into/exists in.

bool|string availableLanguagesJsArray()

Returns the languages the object has been translated into/exists in as a JSON string

eZContentLanguage[]|array languages()

eZContentLanguage[]|array allLanguages()

setClassName(string $name)

eZContentClassAttribute[]|array|null fetchClassAttributes(int $version, bool $asObject = true)

Returns the attributes for the content object version \a $version and content object \a $contentObjectID.

postUnserialize(mixed $package)

Performs additional unserialization actions that need to be performed when all objects contained in the package are already installed.

bool|DOMElement serialize(mixed $package, int|bool $specificVersion = false, array|bool $options = false, int[]|bool $contentNodeIDArray = false, int[]|bool $topNodeIDArray = false)

Returns a DOM structure of the content object and it's attributes.

array cacheInfo($Params $Params)

Returns a structure with information required for caching.

eZUser[] authorArray()

Returns a list of all the authors for this object

bool rename(string $newName)

Sets the object's name to $newName: tries to find attributes that are in 'object pattern name' and updates them

bool removeTranslation(int $languageID)

Removes a translation from the current object

int isAlwaysAvailable()

setAlwaysAvailableLanguageID(int $languageID, int|bool $version = false)

eZSection[]|null allowedAssignSectionList()

array allowedAssignStateIDList(eZUser $user = null)

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

array allowedAssignStateList(eZUser $user = null)

array stateIDArray(bool $refreshCache = false)

Gets the current states of the content object.

array 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|bool sectionIdentifier()

Returns object's section identifier

Details

at line 48
public __construct(int|array $row)

Initializes the object with $row.

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 64
public eZPersistentObject(int|array $row = null)

Parameters

int|array $row

in eZPersistentObject at line 80
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 110
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 187
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 213
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 239
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 271
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 250
public void store(array $fieldFilters = null)

Stores the object

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 $fieldFilters

Return Value

void

in eZPersistentObject at line 319
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 338
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 621
static public string conditionText(array $conditions)

Calls conditionTextByRow with an empty row and $conditions.

Parameters

array $conditions

Return Value

string

in eZPersistentObject at line 636
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 799
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 956
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 1000
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 1027
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 1062
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 1159
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 1170
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 1202
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 1285
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 1302
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 1322
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 1367
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 1407
public bool hasDirtyData()

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

Return Value

bool

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

Sets whether the object has dirty data or not.

Parameters

bool $hasDirtyData

Return Value

void

in eZPersistentObject at line 1431
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 230
public array|bool matchIngroupIDList()

Get class groups this object's class belongs to if match for class groups is enabled, otherwise false

Return Value

array|bool

at line 307
public storeNodeModified()

Update all nodes to set modified_subnode value

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.

at line 330
public bool|string name(int|bool $version = false, bool $lang = false)

Returns an object's name for the version given by $version in the language given by $lang

Parameters

int|bool $version If omitted, the current version will be used
bool $lang If omitted, the initial object language will be used

Return Value

bool|string

at line 355
public string[] names()

Returns all translations of the current object's name

Return Value

string[]

at line 378
public string|bool versionLanguageName(int $version, string|bool $lang = false)

Returns the object name for version $version in the language $lang

Parameters

int $version
string|bool $lang If omitted, the initial language of the object is used

Return Value

string|bool

at line 458
public setCachedName(string $name)

Sets the name of the object, in memory only.

Use {see setName()} to change it permanently

Parameters

string $name

at line 473
public setName(string $objectName, int|bool $versionNum = false, int|bool $languageCode = false)

Sets the name of the object in all translations.

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 $objectName
int|bool $versionNum
int|bool $languageCode

at line 542
public eZContentObjectAttribute[] dataMap()

Return a map with all the content object attributes where the keys are the attribute identifiers.

Return Value

eZContentObjectAttribute[]

at line 555
public array groupedDataMap()

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

Result is not cached, so make sure you don't call this over and over.

Return Value

array

at line 569
static public array createGroupedDataMap(eZContentObjectAttribute[] $contentObjectAttributes)

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

Result is not cached, so make sure you don't call this over and over.

Parameters

eZContentObjectAttribute[] $contentObjectAttributes Array of eZContentObjectAttribute objects

Return Value

array

at line 599
public eZContentObjectAttribute[] fetchDataMap(int|bool $version = false, string|bool $language = false)

Returns a map with all the content object attributes where the keys are the attribute identifiers.

Parameters

int|bool $version
string|bool $language

Return Value

eZContentObjectAttribute[]

at line 653
public array resetDataMap()

Resets (empties) the current object's data map

Return Value

array

at line 671
public eZContentObjectAttribute[]|array|null fetchAttributesByIdentifier(string[] $identifierArray, int|bool $version = false, string[]|bool $languageArray = false, bool $asObject = true)

Fetches a set of content object attributes by their class identifiers.

Parameters

string[] $identifierArray
int|bool $version
string[]|bool $languageArray
bool $asObject If true, returns an array of eZContentObjectAttributes, a normal array otherwise

Return Value

eZContentObjectAttribute[]|array|null

at line 758
public eZContentObject|null owner()

Returns the owner of the object as a content object.

Return Value

eZContentObject|null

at line 772
public array contentClassGroupIDList()

Returns the content class group identifiers for the current content object

Return Value

array

at line 785
public string|bool|null contentClassIdentifier()

Returns the content class identifer for the current content object

The object will cache the class name information so multiple calls will be fast.

Return Value

string|bool|null

at line 806
public eZContentClass|null contentClass()

Returns the content class for the current content object

Return Value

eZContentClass|null

at line 822
public string remoteID()

Returns the remote id of the current content object

Return Value

string

at line 842
public int|null mainParentNodeID()

Returns the ID of the the current object's main node

Return Value

int|null

at line 1201
public eZContentObjectVersion|array|bool currentVersion(bool $asObject = true)

Returns the current version of this document.

Parameters

bool $asObject If true, returns an eZContentObjectVersion; if false, returns an array

Return Value

eZContentObjectVersion|array|bool

at line 1211
public int|null publishedVersion()

Returns the published version of the object, or null if not published yet.

Return Value

int|null

at line 1234
public eZContentObjectVersion|array|bool version(int $version, bool $asObject = true)

Returns the given object version.

False is returned if the versions does not exist.

Parameters

int $version
bool $asObject If true, returns an eZContentObjectVersion; if false, returns an array

Return Value

eZContentObjectVersion|array|bool

at line 1266
public eZContentObjectVersion[]|array versions(bool $asObject = true, array $parameters = array())

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

Parameters

bool $asObject If true, returns an eZContentObjectVersion; if false, returns an array
array $parameters

Return Value

eZContentObjectVersion[]|array

at line 1298
public bool hasRemainingVersions()

Returns true if the object has any versions remaining.

Return Value

bool

at line 1316
public eZContentObjectVersion createInitialVersion(int $userID, string|bool $initialLanguageCode = false)

Creates an initial content object version

Parameters

int $userID
string|bool $initialLanguageCode

Return Value

eZContentObjectVersion

at line 1332
public eZContentObjectVersion createNewVersionIn(string $languageCode, bool $copyFromLanguageCode = false, int|bool $copyFromVersion = false, bool $versionCheck = true, int $status = eZContentObjectVersion::STATUS_DRAFT)

Creates a new version for the language $languageCode

Parameters

string $languageCode
bool $copyFromLanguageCode
int|bool $copyFromVersion
bool $versionCheck
int $status

Return Value

eZContentObjectVersion

at line 1351
public eZContentObjectVersion createNewVersion(int|bool $copyFromVersion = false, bool $versionCheck = true, string|bool $languageCode = false, string|bool $copyFromLanguageCode = false, int $status = eZContentObjectVersion::STATUS_DRAFT)

Creates a new version and returns it as an eZContentObjectVersion object.

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

int|bool $copyFromVersion If given, that version is used to create a copy.
bool $versionCheck If \c true it will check if there are too many version and remove some of them to make room for a new.
string|bool $languageCode
string|bool $copyFromLanguageCode
int $status

Return Value

eZContentObjectVersion

at line 1462
public eZContentObjectVersion copyVersion(eZContentObject $newObject, eZContentObjectVersion $version, int $newVersionNumber, int|bool $contentObjectID = false, int $status = eZContentObjectVersion::STATUS_DRAFT, string|bool $languageCode = false, string|bool $copyFromLanguageCode = false)

Creates a new version and returns it as an eZContentObjectVersion object.

If version number is given as argument that version is used to create a copy.

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

eZContentObject $newObject
eZContentObjectVersion $version
int $newVersionNumber
int|bool $contentObjectID
int $status
string|bool $languageCode If false all languages will be copied, otherwise only specified by the locale code string or an array of the locale code strings.
string|bool $copyFromLanguageCode

Return Value

eZContentObjectVersion

at line 1621
public __clone()

Resets certain attributes of the content object on clone and resets the data map

at line 1638
public eZContentObject copy(bool $allVersions = true)

Makes a copy of the object which is stored and then returns it.

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

bool $allVersions If true, all versions are copied. If false, only the latest version is copied

Return Value

eZContentObject

at line 1751
public int copyRevertTo(int $version, string|bool $language = false)

Copies the given version of the object and creates a new current version.

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

int $version
string|bool $language

Return Value

int The new version number

at line 1801
public purge()

Deletes the current object, all versions and translations, and corresponding tree nodes from the database

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.

at line 1939
public removeThis(int $nodeID = null)

Archives the current object and removes assigned nodes

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

int $nodeID

at line 2022
public cleanupInternalDrafts(int|bool $userID = false, int $timeDuration = 86400)

Removes old internal drafts by the specified user associated for the past time span given by $timeDuration

Parameters

int|bool $userID The ID of the user to cleanup for, if false it will use the current user.
int $timeDuration default time duration for internal drafts 606024 seconds (1 day)

at line 2090
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 {see eZPersistentObject::fetchObjectList}

Return Value

eZContentObjectAttribute[]|array|null

at line 2114
public eZContentObjectAttribute[]|array contentObjectAttributes(bool $asObject = true, int|bool $version = false, string|bool $language = false, int|bool $contentObjectAttributeID = false, bool $distinctItemsOnly = false)

Fetches the attributes for the current published version of the object.

Parameters

bool $asObject
int|bool $version
string|bool $language
int|bool $contentObjectAttributeID
bool $distinctItemsOnly

Return Value

eZContentObjectAttribute[]|array

at line 2203
public setContentObjectAttributes(eZContentObjectAttribute[] $attributes, int $version, string $language)

Initializes the cached copy of the content object attributes for the given version and language

Parameters

eZContentObjectAttribute[] $attributes
int $version
string $language

at line 2291
public resetInputRelationList()

Resets the object's input relation list

at line 2301
public appendInputRelationList(int[] $addingIDList, int $relationType)

Parameters

int[] $addingIDList
int $relationType

at line 2330
public bool commitInputRelations(int|bool $editVersion)

Parameters

int|bool $editVersion

Return Value

bool

at line 2361
public array validateInput(eZContentObjectAttribute[] $contentObjectAttributes, string $attributeDataBaseName, array|bool $inputParameters = false, array $parameters = array())

Parameters

eZContentObjectAttribute[] $contentObjectAttributes
string $attributeDataBaseName
array|bool $inputParameters
array $parameters

Return Value

array

at line 2488
public fixupInput(eZContentObjectAttribute[] $contentObjectAttributes, string $attributeDataBaseName)

Parameters

eZContentObjectAttribute[] $contentObjectAttributes
string $attributeDataBaseName

at line 2504
public array fetchInput(eZContentObjectAttribute[] $contentObjectAttributes, string $attributeDataBaseName, array $customActionAttributeArray, array $customActionParameters)

Parameters

eZContentObjectAttribute[] $contentObjectAttributes
string $attributeDataBaseName
array $customActionAttributeArray
array $customActionParameters

Return Value

array

at line 2569
public handleCustomHTTPActions(eZContentObjectAttribute $contentObjectAttribute, string $attributeDataBaseName, array $customActionAttributeArray, array $customActionParameters)

Parameters

eZContentObjectAttribute $contentObjectAttribute
string $attributeDataBaseName
array $customActionAttributeArray
array $customActionParameters

at line 2591
public handleAllCustomHTTPActions(string $attributeDataBaseName, array $customActionAttributeArray, array $customActionParameters, int|bool $objectVersion = false)

Parameters

string $attributeDataBaseName
array $customActionAttributeArray
array $customActionParameters
int|bool $objectVersion

at line 2654
public storeInput(eZContentObjectAttribute[] $contentObjectAttributes, array $attributeInputMap)

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

eZContentObjectAttribute[] $contentObjectAttributes
array $attributeInputMap

at line 2675
public int nextVersion()

Returns the next available version number for this object.

Return Value

int

at line 2689
public int|bool previousVersion()

Returns the previous available version number for this object, if existing, false otherwise ( if the object has only one version )

Return Value

int|bool

at line 2710
public mixed getVersionCount()

Returns the number of existing versions.

Return Value

mixed

at line 2724
public bool|string currentLanguage()

Returns the current object's language

Return Value

bool|string

at line 2734
public eZContentLanguage|bool| currentLanguageObject()

Returns the language object of the current object's language

Return Value

eZContentLanguage|bool|

at line 2753
public setCurrentLanguage(string $lang)

Sets the current object's language and resets the name

Parameters

string $lang

at line 2764
public eZContentLanguage|bool initialLanguage()

Returns the current object's initial language object, or false if not set

Return Value

eZContentLanguage|bool

at line 2774
public string|bool initialLanguageCode()

Returns the current object's initial language code, or false if not set

Return Value

string|bool

at line 2792
public eZContentObjectTreeNode|int addLocation(int $parentNodeID, bool $asObject = false)

Adds a new location (node) to the current object.

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

int $parentNodeID The id of the node to use as parent.
bool $asObject If true it will return the new child-node as an object, if not it returns the ID.

Return Value

eZContentObjectTreeNode|int

at line 2829
public bool|void addContentObjectRelation(int $toObjectID, int|bool $fromObjectVersion = false, int $attributeID, int $relationType = eZContentObject::RELATION_COMMON)

Adds a link to the given content object id.

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

int $toObjectID
int|bool $fromObjectVersion
int $attributeID
int $relationType

Return Value

bool|void

at line 2920
public removeContentObjectRelation(int|bool $toObjectID = false, bool $fromObjectVersion = false, int $attributeID, int $relationType = eZContentObject::RELATION_COMMON)

Removes a link to the given content object id.

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

int|bool $toObjectID If false it will delete relations to all the objects.
bool $fromObjectVersion
int $attributeID ID of class attribute. If it is > 0 we remove relations created by a specific objectrelation[list] attribute. If it is set to 0 we remove relations created without using of objectrelation[list] attribute. If it is set to false, we remove all relations, no matter how were they created: using objectrelation[list] attribute or using "Add related objects" functionality in obect editing mode.
int $relationType

at line 2998
public copyContentObjectRelations(int $currentVersion, int $newVersion, int|bool $newObjectID = false)

Parameters

int $currentVersion
int $newVersion
int|bool $newObjectID

at line 3104
public eZContentObject[]|array relatedObjects(int|bool $fromObjectVersion = false, int|bool $objectID = false, int|bool $attributeID, bool $groupByAttribute = false, array|bool $params = false, bool $reverseRelatedObjects = false)

Returns related or reverse related objects

Parameters

int|bool $fromObjectVersion If omitted, the current version will be used
int|bool $objectID If omitted, the current object will be used
int|bool $attributeID makes sense only when $params['AllRelations'] not set or eZContentObject::RELATIONATTRIBUTE $attributeID = 0|false ( $params['AllRelations'] is eZContentObject::RELATIONATTRIBUTE ) - return relations made with any attributes $attributeID > 0 - return relations made with attribute ID ( "related object(s)" datatype ) $attributeID = false ( $params['AllRelations'] not set ) - return ALL relations (deprecated, use "$params['AllRelations'] = true" instead)
bool $groupByAttribute This parameter makes sense only when $attributeID == false or $params['AllRelations'] = true $groupByAttribute = false - return all relations as an array of content objects $groupByAttribute = true - return all relations groupped by attribute ID
array|bool $params Other parameters from template fetch function $params['AllRelations'] = true - return ALL relations, including attribute-level $params['AllRelations'] = false - return objec level relations only $params['AllRelations'] = int > 0 - bit mask of EZCONTENTOBJECTRELATION* values $params['SortBy'] - Possible values: "classidentifier", "classname", "modified", "name", "published", "section" $params['IgnoreVisibility'] = true - Include related objects with a 'hidden' state $params['IgnoreVisibility'] = false - Exclude related objects with a 'hidden' state $params['RelatedClassIdentifiers'] = array - limit returned relations to objects of the specified class identifiers
bool $reverseRelatedObjects true -> returns reverse related objects false -> returns related objects

Return Value

eZContentObject[]|array eZContentObject[], if $params['AsObject'] is set to true (default), array otherwise

at line 3309
public array|eZContentObject[] relatedContentObjectList(int|bool $fromObjectVersion = false, int|bool $fromObjectID = false, int|bool $attributeID, bool $groupByAttribute = false, array|bool $params = false)

Returns related objects.

Parameters

int|bool $fromObjectVersion
int|bool $fromObjectID
int|bool $attributeID
bool $groupByAttribute
array|bool $params

Return Value

array|eZContentObject[]

See also

relatedObjects()

at line 3328
public array|eZContentObject[] linkedContentObjectList(int|bool $fromObjectVersion = false, int|bool $fromObjectID = false)

Returns the xml-linked objects.

Parameters

int|bool $fromObjectVersion
int|bool $fromObjectID

Return Value

array|eZContentObject[]

See also

relatedObjects()

at line 3346
public array|eZContentObject[] embeddedContentObjectList(int|bool $fromObjectVersion = false, int|bool $fromObjectID = false)

Returns the xml-embedded objects.

Parameters

int|bool $fromObjectVersion
int|bool $fromObjectID

Return Value

array|eZContentObject[]

See also

relatedObjects()

at line 3364
public array|eZContentObject[] reverseLinkedObjectList(int|bool $fromObjectVersion = false, int|bool $fromObjectID = false)

Returns the reverse xml-linked objects.

Parameters

int|bool $fromObjectVersion
int|bool $fromObjectID

Return Value

array|eZContentObject[]

See also

relatedObjects()

at line 3383
public array|eZContentObject[] reverseEmbeddedObjectList(int|bool $fromObjectVersion = false, int|bool $fromObjectID = false)

Returns the reverse xml-embedded objects.

Parameters

int|bool $fromObjectVersion
int|bool $fromObjectID

Return Value

array|eZContentObject[]

See also

relatedObjects()

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

Left for compatibility

Parameters

$fromObjectVersion
$fromObjectID
$attributeID
$params

Return Value

array

See also

relatedObjects()

at line 3427
public int relatedContentObjectCount(int|bool $fromObjectVersion = false, int|bool $attributeID, array|bool $params = false)

Returns the number of related objects

Parameters

int|bool $fromObjectVersion
int|bool $attributeID
array|bool $params

Return Value

int

See also

relatedObjectCount()

at line 3449
public array|eZContentObject[] reverseRelatedObjectList(int|bool $version = false, int|bool $attributeID, bool $groupByAttribute = false, array|bool $params = false)

Returns the objects to which this object are related .

Parameters

int|bool $version
int|bool $attributeID
bool $groupByAttribute
array|bool $params

Return Value

array|eZContentObject[]

See also

relatedObjects()

at line 3465
public int linkedContentObjectCount(int|bool $fromObjectVersion = false)

Returns the xml-linked objects count.

Parameters

int|bool $fromObjectVersion

Return Value

int

See also

relatedObjectCount()

at line 3481
public int embeddedContentObjectCount(int|bool $fromObjectVersion = false)

Returns the xml-embedded objects count.

Parameters

int|bool $fromObjectVersion

Return Value

int

See also

relatedObjectCount()

at line 3497
public int reverseLinkedObjectCount(int|bool $fromObjectVersion = false)

Returns the reverse xml-linked objects count.

Parameters

int|bool $fromObjectVersion

Return Value

int

See also

relatedObjectCount()

at line 3513
public int reverseEmbeddedObjectCount(int|bool $fromObjectVersion = false)

Returns the reverse xml-embedded objects count.

Parameters

int|bool $fromObjectVersion

Return Value

int

See also

relatedObjectCount()

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

Fetch the number of (reverse) related objects

Parameters

bool|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|bool $reverseRelatedObjects Wether to count related objects (false) or reverse related objects (false)
array|bool $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 3651
public int reverseRelatedObjectCount(int|bool $version = false, int|bool $attributeID, array|bool $params = false)

Returns the number of objects to which this object is related.

Parameters

int|bool $version
int|bool $attributeID
array|bool $params

Return Value

int

See also

relatedObjectCount()

at line 3665
public array|eZContentObject[] contentObjectListRelatingThis(int|bool $version = false)

Returns the related objects.

Parameters

int|bool $version

Return Value

array|eZContentObject[]

See also

reverseRelatedObjectList()

at line 3675
public int[] parentNodeIDArray()

Returns an array of parent node IDs

Return Value

int[]

at line 3687
public eZContentObjectTreeNode[]|int[] parentNodes(int|bool $version = false, bool $asObject = true)

Returns the parent nodes for the current object.

Parameters

int|bool $version No longer in use, published nodes are used instead.
bool $asObject If true it fetches PHP objects, otherwise it fetches IDs.

Return Value

eZContentObjectTreeNode[]|int[]

at line 3729
public eZNodeAssignment|null createNodeAssignment(int $parentNodeID, bool $isMain, string|bool $remoteID = false, int $sortField = eZContentObjectTreeNode::SORT_FIELD_PUBLISHED, int $sortOrder = eZContentObjectTreeNode::SORT_ORDER_DESC)

Creates and returns a new node assignment that will place the object as child of node $nodeID.

The returned assignment will already be stored in the database

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

int $parentNodeID The node ID of the parent node
bool $isMain True if the created node is the main node of the object
string|bool $remoteID A string denoting the unique remote ID of the assignment or \c false for no remote id.
int $sortField
int $sortOrder

Return Value

eZNodeAssignment|null

at line 3791
public eZContentObjectTreeNode[] visibleNodes()

Returns the visible nodes of the current object.

The main node is the first element in the returned value (if it is considered visible).

The setting site.ini/[SiteAccessSettings]/ShowHiddenNodes is taken into account, ie an hidden (or hidden by superior) node is considered visible if ShowHiddenNodes is true.

Return Value

eZContentObjectTreeNode[]

See also

eZContentObject::assignedNodes

at line 3817
public boolean hasVisibleNode()

Returns whether the current object has at least one visible node.

The setting site.ini/[SiteAccessSettings]/ShowHiddenNodes is taken into account, ie an hidden (or hidden by superior) node is considered visible if ShowHiddenNodes is true.

Return Value

boolean

at line 3846
public eZContentObjectTreeNode[]|array[] assignedNodes(boolean $asObject = true, boolean $checkVisibility = false)

Returns the node assignments for the current object.

Parameters

boolean $asObject
boolean $checkVisibility if true, the visibility and the setting site.ini/[SiteAccessSettings]/ShowHiddenNodes are taken into account.

Return Value

eZContentObjectTreeNode[]|array[]

at line 3891
public int|null mainNodeID()

Returns the main node id for the current object and sets the attribute MainNodeID in the current object

Return Value

int|null

at line 3906
public int|null mainNode()

Returns the main node id for the current object.

Return Value

int|null

at line 3916
public setPermissions(array $permissionArray)

Sets the permissions for this object.

Parameters

array $permissionArray

at line 3926
public array permissions()

Returns the permission for the current object.

Return Value

array

at line 3936
public eZContentLanguage[] canEditLanguages()

Returns a list of languages of the current object that the current user can edit

Return Value

eZContentLanguage[]

at line 3959
public eZContentLanguage[] canCreateLanguages()

Returns a list of languages of the current object that the current user can create

Return Value

eZContentLanguage[]

at line 3982
public string checkGroupLimitationAccess(array $limitationValueList, int $userID, int|bool $contentObjectID = false)

Parameters

array $limitationValueList
int $userID
int|bool $contentObjectID

Return Value

string Returns "denied" or "allowed"

at line 4039
public array|int checkAccess(string $functionName, int|bool $originalClassID = false, int|bool $parentClassID = false, bool $returnAccessList = false, string|bool $language = false)

Check access for the current object

Parameters

string $functionName Function name ( edit, read, remove, etc. )
int|bool $originalClassID Used to check access for object creation
int|bool $parentClassID Used to check access for object creation
bool $returnAccessList If true, returns access list instead of access result
string|bool $language

Return Value

array|int 1 if has access, 0 if not, array if $returnAccessList is true

at line 4617
public array classListFromPolicy(array $policy, array|bool $allowedLanguageCodes = false)

Returns an array of classes the current user has access to

Parameters

array $policy
array|bool $allowedLanguageCodes

Return Value

array

at line 4792
public array|eZPersistentObject[] canCreateClassList(bool $asObject = false, bool $includeFilter = true, bool $groupList = false, bool $fetchID = false)

Finds all classes that the current user can create objects from and returns.

It is also possible to filter the list event more with $includeFilter and $groupList.

Parameters

bool $asObject If true then it return eZContentClass objects, if not it will be an associative array
bool $includeFilter If true then it will include only from class groups defined in $groupList, if not it will exclude those groups.
bool $groupList An array with class group IDs that should be used in filtering, use false if you do not wish to filter at all.
bool $fetchID A unique name for the current fetch, this must be supplied when filtering is used if you want caching to work.

Return Value

array|eZPersistentObject[]

at line 4933
public array|int accessList(string $function)

Get accesslist for specified function

Parameters

string $function

Return Value

array|int

at line 4955
public bool canRead()

Returns true if the current user can read this content object.

Return Value

bool

at line 4969
public bool canPdf()

Returns true if the current user can create a pdf of this content object.

Return Value

bool

at line 4983
public bool canViewEmbed()

Returns true if the node can be viewed as embeded object by the current user.

Return Value

bool

at line 4997
public bool canDiff()

Returns true if the current user can diff this content object.

Return Value

bool

at line 5011
public bool canCreate()

Returns true if the current user can create a content object like this one.

Return Value

bool

at line 5029
public bool canEdit(int|bool $originalClassID = false, int|bool $parentClassID = false, bool $returnAccessList = false, string|bool $language = false)

Returns true if the current user can edit this content object.

Parameters

int|bool $originalClassID
int|bool $parentClassID
bool $returnAccessList
string|bool $language

Return Value

bool

at line 5065
public bool canTranslate()

Returns true if the current user can translate this content object.

Return Value

bool

at line 5091
public bool canRemove()

Returns true if the current user can remove this content object.

Return Value

bool

at line 5106
public bool canMoveFrom()

Returns true if the current user can move this content object.

Return Value

bool

at line 5123
public string|bool|null className()

Returns the name of the class which this object was created from.

The object will cache the class name information so multiple calls will be fast.

Return Value

string|bool|null

at line 5149
public array|bool contentActionList()

Returns an array of the content actions which can be performed on the current object.

Return Value

array|bool

at line 5188
public bool hasContentAction(string $name)

Returns true if the given content action is in the content action list

Parameters

string $name Name of the content action

Return Value

bool

at line 5209
public array availableLanguages()

Returns the languages the object has been translated into/exists in.

Return Value

array An array with the language codes.

at line 5227
public bool|string availableLanguagesJsArray()

Returns the languages the object has been translated into/exists in as a JSON string

Return Value

bool|string

at line 5235
public eZContentLanguage[]|array languages()

Return Value

eZContentLanguage[]|array

at line 5245
public eZContentLanguage[]|array allLanguages()

Return Value

eZContentLanguage[]|array

at line 5294
public setClassName(string $name)

Parameters

string $name

at line 5348
public eZContentClassAttribute[]|array|null fetchClassAttributes(int $version, bool $asObject = true)

Returns the attributes for the content object version \a $version and content object \a $contentObjectID.

Parameters

int $version
bool $asObject

Return Value

eZContentClassAttribute[]|array|null

at line 5711
public postUnserialize(mixed $package)

Performs additional unserialization actions that need to be performed when all objects contained in the package are already installed.

(maintain objects' cross-relations)

Parameters

mixed $package

at line 5732
public bool|DOMElement serialize(mixed $package, int|bool $specificVersion = false, array|bool $options = false, int[]|bool $contentNodeIDArray = false, int[]|bool $topNodeIDArray = false)

Returns a DOM structure of the content object and it's attributes.

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

mixed $package
int|bool $specificVersion Content object version, true for current version, false for all, else array containing specific versions.
array|bool $options Package options or false
int[]|bool $contentNodeIDArray Array of allowed nodes or false
int[]|bool $topNodeIDArray Array of top nodes in current package export or false

Return Value

bool|DOMElement

at line 5833
public array cacheInfo($Params $Params)

Returns a structure with information required for caching.

Parameters

$Params $Params array

Return Value

array

at line 5961
public eZUser[] authorArray()

Returns a list of all the authors for this object

Return Value

eZUser[]

at line 6016
public bool rename(string $newName)

Sets the object's name to $newName: tries to find attributes that are in 'object pattern name' and updates them

Parameters

string $newName

Return Value

bool true if object's name was changed, otherwise false.

at line 6104
public bool removeTranslation(int $languageID)

Removes a translation from the current object

Parameters

int $languageID

Return Value

bool

at line 6225
public int isAlwaysAvailable()

Return Value

int

at line 6234
public setAlwaysAvailableLanguageID(int $languageID, int|bool $version = false)

Parameters

int $languageID
int|bool $version

at line 6296
public eZSection[]|null allowedAssignSectionList()

Return Value

eZSection[]|null

at line 6320
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 6437
public array allowedAssignStateList(eZUser $user = null)

Parameters

eZUser $user

Return Value

array

at line 6485
public array stateIDArray(bool $refreshCache = false)

Gets the current states of the content object.

Uses a member variable that caches the result.

Parameters

bool $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 6513
public array stateIdentifierArray()

Return Value

array

at line 6544
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 6575
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 6593
public restoreObjectAttributes()

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

at line 6618
public string|bool sectionIdentifier()

Returns object's section identifier

Return Value

string|bool