eZPublish  4.7
eZContentClass Class Reference

Handles eZ Publish content classes. More...

+ Inheritance diagram for eZContentClass:
+ Collaboration diagram for eZContentClass:

Public Member Functions

 __clone ()
 
 adjustAttributePlacements ($attributes)
 
 alwaysAvailableLanguage ()
 
 alwaysAvailableLanguageLocale ()
 
 buildContentObjectName ($contentObjectName, $dataMap, $tmpTags=false)
 
 canCreateLanguages ()
 
 canInstantiateClasses ()
 
 canInstantiateLanguages ()
 
 clearAlwaysAvailableLanguageID ()
 
 compareAttributes ($attr1, $attr2)
 
 contentObjectName (eZContentObject $contentObject, $version=false, $translation=false)
 Will generate a name for the content object based on the class settings for content object limited by self::CONTENT_OBJECT_NAME_MAX_LENGTH. More...
 
 creator ()
 
 dataMap ()
 
 description ($languageLocale=false)
 
 descriptionList ()
 
 eZContentClass ($row)
 
 fetchAllGroups ()
 
 fetchAttributeByIdentifier ($identifier, $asObject=true)
 
 fetchAttributes ($id=false, $asObject=true, $version=eZContentClass::VERSION_STATUS_DEFINED)
 
 fetchGroupIDList ()
 
 fetchGroupList ()
 
 fetchMatchGroupIDList ()
 
 fetchSearchableAttributes ($id=false, $asObject=true, $version=eZContentClass::VERSION_STATUS_DEFINED)
 
 hasNameInLanguage ($languageLocale)
 
 inGroup ($groupID)
 
 initializeCopy (&$originalClass)
 
 instantiate ($userID=false, $sectionID=0, $versionNumber=false, $languageCode=false, $versionStatus=eZContentObjectVersion::STATUS_INTERNAL_DRAFT)
 
 instantiateIn ($lang, $userID=false, $sectionID=0, $versionNumber=false, $versionStatus=eZContentObjectVersion::STATUS_INTERNAL_DRAFT)
 
 isRemovable ()
 
 languages ()
 
 modifier ()
 
 name ($languageLocale=false)
 
 nameList ()
 
 objectCount ()
 
 objectList ()
 
 prioritizedLanguages ()
 
 prioritizedLanguagesJsArray ()
 
 remoteID ()
 
 removableInformation ($includeAll=true)
 
 remove ($removeAttributes=false, $version=eZContentClass::VERSION_STATUS_DEFINED)
 
 removeAttributes ($removeAttributes=false, $version=false)
 
 removeTranslation ($languageID)
 
 setAlwaysAvailableLanguageID ($languageID, $updateChilds=true)
 
 setCanInstantiateLanguages ($languageCodes)
 
 setDescription ($description, $languageLocale=false)
 
 setName ($name, $languageLocale=false)
 
 setVersion ($version, $set_childs=false)
 
 store ($store_childs=false, $fieldFilters=null)
 
 storeDefined ($attributes)
 Stores the current class as a defined version, updates the contentobject_name attribute and recreates the class group entries. More...
 
 storeVersioned ($attributes, $version)
 Stores the current class as a modified version, updates the contentobject_name attribute and recreates the class group entries. More...
 
 sync ($fieldFilters=null)
 
 topPriorityLanguageLocale ()
 
 urlAliasName (eZContentObject $contentObject, $version=false, $translation=false)
 Will generate a name for the url alias based on the class settings for content object limited by site.ini[URLTranslator]. More...
 
 versionCount ()
 
 versionStatus ()
 
- Public Member Functions inherited from eZPersistentObject
 attribute ($attr, $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. More...
 
 attributes ()
 Returns the attributes for this object, taken from the definition fields and function attributes. More...
 
 eZPersistentObject ($row)
 Initializes the object with the $row. More...
 
 fill ($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. More...
 
 hasAttribute ($attr)
 Checks if $attr is part of the definition fields or function attributes. More...
 
 hasDirtyData ()
 Returns true if the data is considered dirty and needs to be stored. More...
 
 remove ($conditions=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. More...
 
 setAttribute ($attr, $val)
 Sets the attribute $attr to the value $val. More...
 
 setHasDirtyData ($hasDirtyData)
 Sets whether the object has dirty data or not. More...
 
 store ($fieldFilters=null)
 Stores the object in the database, uses storeObject() to do the actual job and passes $fieldFilters to it. More...
 
 sync ($fieldFilters=null)
 Makes sure data is stored if the data is considered dirty. More...
 

Static Public Member Functions

static canInstantiateClassList ($asObject=false, $includeFilter=true, $groupList=false, $fetchID=false)
 
static classIDByIdentifier ($identifier)
 Resolves the string class identifier $identifier to its numeric value Use eZContentObjectTreeNode::classIDByIdentifier() for < 4.1. More...
 
static classIdentifierByID ($id)
 Resolves the numeric class identifier $id to its string value. More...
 
static create ($userID=false, $optionalValues=array(), $languageLocale=false)
 
static definition ()
 
static descriptionFromSerializedString ($serializedNameList)
 
static exists ($id, $version=eZContentClass::VERSION_STATUS_DEFINED, $userID=false, $useIdentifier=false)
 
static expireCache ()
 Expires in-memory cache for eZContentClass. More...
 
static fetch ($id, $asObject=true, $version=eZContentClass::VERSION_STATUS_DEFINED, $user_id=false, $parent_id=null)
 
static fetchAllClasses ($asObject=true, $includeFilter=true, $groupList=false)
 
static fetchByIdentifier ($identifier, $asObject=true, $version=eZContentClass::VERSION_STATUS_DEFINED, $user_id=false, $parent_id=null)
 
static fetchByRemoteID ($remoteID, $asObject=true, $version=eZContentClass::VERSION_STATUS_DEFINED, $user_id=false, $parent_id=null)
 
static fetchIDListContainingDatatype ($dataTypeString)
 
static fetchList ($version=eZContentClass::VERSION_STATUS_DEFINED, $asObject=true, $user_id=false, $sorts=null, $fields=null, $classFilter=false, $limit=null)
 
static nameFromSerializedString ($serializedNameList)
 
static removeTemporary ()
 
static versionHistoryLimit ($class)
 Computes the version history limit for a content class. More...
 
- Static Public Member Functions inherited from eZPersistentObject
static conditionText ($conditions)
 Calls conditionTextByRow with an empty row and $conditions. More...
 
static conditionTextByRow ($conditions, $row)
 Generates an SQL sentence from the conditions $conditions and row data $row. More...
 
static count ($def, $conds=null, $field=null)
 Fetches the number of rows by using the object definition. More...
 
static definition ()
 Returns the definition for the object, the default implementation is to return an empty array. More...
 
static escapeArray ($array)
 Escapes strings in an array with the help of eZDBInterface::escapeString(). More...
 
static 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. More...
 
static fetchObjectList ($def, $field_filters=null, $conds=null, $sorts=null, $limit=null, $asObject=true, $grouping=false, $custom_fields=null, $custom_tables=null, $custom_conds=null)
 Creates an SQL query out of the different parameters and returns an array with the result. More...
 
static getShortAttributeName ($db, $def, $attrName)
 Returns the short attribute name (alias) if it's defined, given attribute name otherwise. More...
 
static handleRows ($rows, $class_name, $asObject)
 Creates PHP objects out of the database rows $rows. More...
 
static newObjectOrder ($def, $orderField, $conditions)
 Returns an order value which can be used for new items in table, for instance placement. More...
 
static removeObject ($def, $conditions=null, $extraConditions=null)
 Deletes the object from the table defined in $def with conditions $conditions and extra conditions $extraConditions. More...
 
static reorderObject ($def, $orderField, $conditions, $down=true)
 Moves a row in a database table. More...
 
static replaceFieldsWithShortNames ($db, $fieldDefs, &$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. More...
 
static storeObject ($obj, $fieldFilters=null)
 Stores the data in $obj to database. More...
 
static swapRow ($table, $keys, $order_id, $rows, $id1, $id2)
 Sets row id $id2 to have the placement of row id $id1. More...
 
static updateObjectList ($parameters)
 Updates rows matching the given parameters. More...
 

Public Attributes

 $AllGroups
 
 $CanInstantiateLanguages
 
 $ContentObjectName
 
 $Created
 
 $CreatorID
 
 $DescriptionList
 
 $ID
 
 $Identifier
 
 $InGroups
 
 $IsContainer
 
 $LanguageMask
 
 $Modified
 
 $ModifierID
 
 $NameList
 
 $SerializedNameList
 
 $Version
 
 $VersionCount
 
const CONTENT_OBJECT_NAME_MAX_LENGTH = 255
 
const VERSION_STATUS_DEFINED = 0
 
const VERSION_STATUS_MODIFIED = 2
 
const VERSION_STATUS_TEMPORARY = 1
 
- Public Attributes inherited from eZPersistentObject
 $PersistentDataDirty
 

Static Protected Member Functions

static classIdentifiersHash ()
 Returns the class identifier hash for the current database. More...
 

Static Private Attributes

static $identifierHash = null
 In-memory cache for class identifiers / id matching. More...
 

Detailed Description

Handles eZ Publish content classes.

See Also
eZContentObject

Member Function Documentation

eZContentClass::__clone ( )
eZContentClass::adjustAttributePlacements (   $attributes)

Referenced by storeVersioned().

eZContentClass::alwaysAvailableLanguage ( )

Wrapper for eZContentClassNameList::alwaysAvailableLanguage.

Returns
'language' object.
eZContentClass::alwaysAvailableLanguageLocale ( )

Wrapper for eZContentClassNameList::alwaysAvailableLanguageLocale.

Returns
'language' object.
eZContentClass::buildContentObjectName (   $contentObjectName,
  $dataMap,
  $tmpTags = false 
)

Generates a name for the content object based on the content object name pattern and data map of an object.

eZContentClass::canCreateLanguages ( )
eZContentClass::canInstantiateClasses ( )
static eZContentClass::canInstantiateClassList (   $asObject = false,
  $includeFilter = true,
  $groupList = false,
  $fetchID = false 
)
static

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
$asObjectIf true then it return eZContentClass objects, if not it will be an associative array with name and id keys.
$includeFilterIf true then it will include only from class groups defined in $groupList, if not it will exclude those groups.
$groupListAn array with class group IDs that should be used in filtering, use false if you do not wish to filter at all.
$fetchIDA unique name for the current fetch, this must be supplied when filtering is used if you want caching to work.

Referenced by eZContentFunctionCollection\canInstantiateClassList(), and eZContentObjectTreeNode\getClassesJsArray().

eZContentClass::canInstantiateLanguages ( )
static eZContentClass::classIDByIdentifier (   $identifier)
static

Resolves the string class identifier $identifier to its numeric value Use eZContentObjectTreeNode::classIDByIdentifier() for < 4.1.

If multiple classes have the same identifier, the first found is returned.

Since
Version 4.1
Parameters
string | array$identifieridentifier string or array of identifiers (array support added in 4.1.1)
Returns
int|false Returns classid or false

Referenced by eZContentObjectTreeNode\classIDByIdentifier(), eZContentObjectTreeNode\createClassFilteringSQLString(), eZContentObjectTreeNode\subTreeCountByNodeID(), and versionHistoryLimit().

static eZContentClass::classIdentifierByID (   $id)
static

Resolves the numeric class identifier $id to its string value.

Since
Version 4.1
Returns
string|false Returns classidentifier or false

Referenced by eZContentObject\contentClassIdentifier(), and versionHistoryLimit().

static eZContentClass::classIdentifiersHash ( )
staticprotected

Returns the class identifier hash for the current database.

If it is outdated or non-existent, the method updates/generates the file

Since
Version 4.1 protected
Returns
array Returns hash of classidentifier => classid
eZContentClass::clearAlwaysAvailableLanguageID ( )
eZContentClass::compareAttributes (   $attr1,
  $attr2 
)
eZContentClass::contentObjectName ( eZContentObject  $contentObject,
  $version = false,
  $translation = false 
)

Will generate a name for the content object based on the class settings for content object limited by self::CONTENT_OBJECT_NAME_MAX_LENGTH.

Parameters
eZContentObject$contentObject
int | false$version
string | false$translation
Returns
string
static eZContentClass::create (   $userID = false,
  $optionalValues = array(),
  $languageLocale = false 
)
static

Creates an 'eZContentClass' object.

To specify contentclass name use either $optionalValues['serialized_name_list'] or combination of $optionalValues['name'] and/or $languageLocale.

In case of conflict(when both 'serialized_name_list' and 'name' with/without $languageLocale are specified) 'serialized_name_list' has top priority. This means that 'name' and $languageLocale will be ingnored because 'serialized_name_list' already has all needed info about names and languages.

If 'name' is specified then the contentclass will have a name in $languageLocale(if specified) or in default language.

If neither of 'serialized_name_list' or 'name' isn't specified then the contentclass will have an empty name in 'languageLocale'(if specified) or in default language.

'language_mask' and 'initial_language_id' attributes will be set according to specified(either in 'serialized_name_list' or by $languageLocale) languages.

Returns
'eZContentClass' object.

Referenced by eZContentClassPackageHandler\install().

eZContentClass::creator ( )
Returns
The creator of the class as an eZUser object by using the $CreatorID as user ID.
eZContentClass::dataMap ( )

Returns all attributes as an associative array with the key taken from the attribute identifier.

static eZContentClass::definition ( )
static
eZContentClass::description (   $languageLocale = false)

Returns a contentclass description in $languageLocale language. Uses siteaccess language list or 'always available' language if $languageLocale is 'false'.

Returns
string with contentclass name.
static eZContentClass::descriptionFromSerializedString (   $serializedNameList)
static

Returns a contentclass description from serialized array $serializedNameList using top language from siteaccess language list or 'always available' name from $serializedNameList.

Returns
string with contentclass description.
eZContentClass::descriptionList ( )
static eZContentClass::exists (   $id,
  $version = eZContentClass::VERSION_STATUS_DEFINED,
  $userID = false,
  $useIdentifier = false 
)
static
static eZContentClass::expireCache ( )
static

Expires in-memory cache for eZContentClass.

Clears cache for fetched eZContentClass objects, class identifiers and class attributes.

Since
4.2

Referenced by eZCache\clearClassID().

eZContentClass::eZContentClass (   $row)
static eZContentClass::fetchAllClasses (   $asObject = true,
  $includeFilter = true,
  $groupList = false 
)
static

Finds all Classes in the system and returns them.

Returns
An array with eZContentClass objects.

Referenced by eZContentObjectTreeNode\availableClassListJsArray().

eZContentClass::fetchAllGroups ( )

Finds all Class groups in the system and returns them.

Returns
An array with eZContentClassGroup objects.
See Also
fetchGroupList(), fetchGroupIDList()
eZContentClass::fetchAttributeByIdentifier (   $identifier,
  $asObject = true 
)

Fetch class attribute by identifier, return null if none exist.

Parameters
attributeidentifier.
Returns
Class Attribute, null if none matched
eZContentClass::fetchGroupIDList ( )

Find all groups the current class is placed in and returns a list of group IDs.

Returns
An array with integers (ids).
See Also
fetchGroupList()
eZContentClass::fetchGroupList ( )

Find all groups the current class is placed in and returns a list of group objects.

Returns
An array with eZContentClassGroup objects.
See Also
fetchGroupIDList()
static eZContentClass::fetchIDListContainingDatatype (   $dataTypeString)
static

Returns an array of IDs of classes containing a specified datatype

Parameters
$dataTypeStringa datatype identification string

Referenced by eZUser\contentClassIDs().

eZContentClass::fetchMatchGroupIDList ( )

Returns the result from fetchGroupIDList() if class group overrides is enabled in content.ini.

Returns
An array with eZContentClassGroup objects or false if disabled.
Note
EnableClassGroupOverride in group ContentOverrideSettings from INI file content.ini controls this behaviour.
eZContentClass::fetchSearchableAttributes (   $id = false,
  $asObject = true,
  $version = eZContentClass::VERSION_STATUS_DEFINED 
)
eZContentClass::hasNameInLanguage (   $languageLocale)
eZContentClass::inGroup (   $groupID)
Returns
true if the class is part of the group $groupID
eZContentClass::initializeCopy ( $originalClass)

Initializes this class as a copy of $originalClass by creating new a new name and identifier. It will check if there are other classes already with this name in which case it will append a unique number to the name and identifier.

eZContentClass::instantiate (   $userID = false,
  $sectionID = 0,
  $versionNumber = false,
  $languageCode = false,
  $versionStatus = eZContentObjectVersion::STATUS_INTERNAL_DRAFT 
)

Creates a new content object instance and stores it.

Parameters
userIDuser ID (optional), current user if not set (also store object id in session if $userID = false)
sectionIDsection ID (optional), 0 if not set
versionNumberversion number, create initial version if not set
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.

Referenced by instantiateIn().

eZContentClass::instantiateIn (   $lang,
  $userID = false,
  $sectionID = 0,
  $versionNumber = false,
  $versionStatus = eZContentObjectVersion::STATUS_INTERNAL_DRAFT 
)
eZContentClass::isRemovable ( )

Checks if the class can be removed and returns true if it can, false otherwise.

See Also
removableInformation()

Referenced by remove().

eZContentClass::languages ( )
eZContentClass::modifier ( )
Returns
The modifier of the class as an eZUser object by using the $ModifierID as user ID.
eZContentClass::name (   $languageLocale = false)

Returns a contentclass name in $languageLocale language. Uses siteaccess language list or 'always available' language if $languageLocale is 'false'.

Returns
string with contentclass name.

Referenced by instantiate().

static eZContentClass::nameFromSerializedString (   $serializedNameList)
static

Returns a contentclass name from serialized array $serializedNameList using top language from siteaccess language list or 'always available' name from $serializedNameList.

Returns
string with contentclass name.

Referenced by eZContentObject\className(), eZContentStructureTreeOperator\createContentStructureNode(), eZContentObject\eZContentObject(), eZContentObject\fetchIDArray(), eZContentObjectTreeNode\makeObjectsArray(), and eZContentObject\relatedObjects().

eZContentClass::nameList ( )
eZContentClass::objectCount ( )
Returns
will return the number of objects published by this class.
eZContentClass::objectList ( )
Returns
will return the list of objects published by this class.
eZContentClass::prioritizedLanguages ( )
eZContentClass::prioritizedLanguagesJsArray ( )
eZContentClass::remoteID ( )

Get remote id of content node

eZContentClass::removableInformation (   $includeAll = true)

Returns information on why the class cannot be removed, it does the same checks as in isRemovable() but generates some text in the return array.

Returns
An array which contains:
  • text - Plain text description why this cannot be removed
  • list - An array with reasons why this failed, each entry contains:
    • text - Plain text description of the reason.
    • list - A sublist of reason (e.g from an attribute), is optional.
Parameters
$includeAllControls whether the returned information will contain all sources for not being to remove or just the first that it finds.

Referenced by isRemovable().

eZContentClass::remove (   $removeAttributes = false,
  $version = eZContentClass::VERSION_STATUS_DEFINED 
)
Note
If you want to remove a class with all data associated with it (objects/classMembers) you should use eZContentClassOperations::remove()
eZContentClass::removeAttributes (   $removeAttributes = false,
  $version = false 
)
Note
Removes class attributes
Parameters
removeAttributesArray of attributes to remove
versionVersion to remove( optional )

Referenced by remove(), and storeVersioned().

static eZContentClass::removeTemporary ( )
static

Will remove all temporary classes from the database.

eZContentClass::removeTranslation (   $languageID)

Removes translated name for specified by $languageID language.

eZContentClass::setAlwaysAvailableLanguageID (   $languageID,
  $updateChilds = true 
)
eZContentClass::setCanInstantiateLanguages (   $languageCodes)
Returns
Sets the languages which are allowed to be instantiated for the class. Used only for the content/ fetch function.
eZContentClass::setDescription (   $description,
  $languageLocale = false 
)
eZContentClass::setName (   $name,
  $languageLocale = false 
)

Referenced by initializeCopy().

eZContentClass::setVersion (   $version,
  $set_childs = false 
)

Referenced by storeVersioned().

eZContentClass::store (   $store_childs = false,
  $fieldFilters = null 
)
eZContentClass::storeDefined (   $attributes)

Stores the current class as a defined version, updates the contentobject_name attribute and recreates the class group entries.

Note
It will remove any existing temporary or defined classes before storing.
Parameters
array$attributesarray of attributes of the content class

Referenced by eZContentClassEditHandler\store().

eZContentClass::storeVersioned (   $attributes,
  $version 
)

Stores the current class as a modified version, updates the contentobject_name attribute and recreates the class group entries.

Note
It will remove classes in the previous and specified version before storing.
Parameters
array$attributesarray of attributes
int$versionversion status
Since
Version 4.3

Referenced by storeDefined().

eZContentClass::sync (   $fieldFilters = null)

Referenced by remoteID().

eZContentClass::topPriorityLanguageLocale ( )
eZContentClass::urlAliasName ( eZContentObject  $contentObject,
  $version = false,
  $translation = false 
)

Will generate a name for the url alias based on the class settings for content object limited by site.ini[URLTranslator].

Parameters
eZContentObject$contentObject
int | false$version
string | false$translation
Returns
string
eZContentClass::versionCount ( )
Deprecated:
Returns
The version count for the class if has been determined.
static eZContentClass::versionHistoryLimit (   $class)
static

Computes the version history limit for a content class.

Parameters
mixed$classContent class ID, content class identifier or content class object
Returns
int
Since
4.2

Referenced by eZContentObject\createNewVersion().

eZContentClass::versionStatus ( )

Member Data Documentation

eZContentClass::$AllGroups

Referenced by fetchAllGroups().

eZContentClass::$CanInstantiateLanguages
eZContentClass::$ContentObjectName

Referenced by contentObjectName(), and urlAliasName().

eZContentClass::$Created
eZContentClass::$CreatorID
eZContentClass::$DescriptionList
eZContentClass::$ID
eZContentClass::$Identifier
eZContentClass::$identifierHash = null
staticprivate

In-memory cache for class identifiers / id matching.

Referenced by classIDByIdentifier(), and classIdentifierByID().

eZContentClass::$InGroups

Referenced by fetchGroupList().

eZContentClass::$IsContainer
eZContentClass::$LanguageMask
eZContentClass::$Modified
eZContentClass::$ModifierID
eZContentClass::$NameList
eZContentClass::$SerializedNameList
eZContentClass::$Version
eZContentClass::$VersionCount

Referenced by versionCount().

const eZContentClass::CONTENT_OBJECT_NAME_MAX_LENGTH = 255
const eZContentClass::VERSION_STATUS_TEMPORARY = 1

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