eZ Publish  [4.2]
eZContentClass Class Reference

Handles eZ Publish content classes. More...

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

List of all members.

Public Member Functions

 __clone ()
 adjustAttributePlacements ($attributes)
 alwaysAvailableLanguage ()
 alwaysAvailableLanguageLocale ()
 buildContentObjectName ($contentObjectName, $dataMap, $tmpTags=false)
 canCreateLanguages ()
 canInstantiateClasses ()
 canInstantiateLanguages ()
 clearAlwaysAvailableLanguageID ()
 compareAttributes ($attr1, $attr2)
 contentObjectName ($contentObject, $version=false, $translation=false)
 creator ()
 dataMap ()
 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)
 setName ($name, $languageLocale=false)
 setVersion ($version, $set_childs=false)
 store ($store_childs=false, $fieldFilters=null)
 storeDefined ($attributes)
 sync ($fieldFilters=null)
 topPriorityLanguageLocale ()
 urlAliasName ($contentObject, $version=false, $translation=false)
 versionCount ()
 versionStatus ()

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.
static classIdentifierByID ($id)
 Resolves the numeric class identifier $id to its string value.
static create ($userID=false, $optionalValues=array(), $languageLocale=false)
static definition ()
static exists ($id, $version=eZContentClass::VERSION_STATUS_DEFINED, $userID=false, $useIdentifier=false)
static expireCache ()
 Expires in-memory cache for eZContentClass.
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.

Public Attributes

 $AllGroups
 $CanInstantiateLanguages
 $ContentObjectName
 $Created
 $CreatorID
 $ID
 $Identifier
 $InGroups
 $IsContainer
 $LanguageMask
 $Modified
 $ModifierID
 $NameList
 $SerializedNameList
 $Version
 $VersionCount
const VERSION_STATUS_DEFINED = 0
const VERSION_STATUS_MODIFIED = 2
const VERSION_STATUS_TEMPORARY = 1

Static Protected Member Functions

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

Static Private Attributes

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

Detailed Description

Handles eZ Publish content classes.

See also:
eZContentObject

Definition at line 41 of file ezcontentclass.php.


Member Function Documentation

eZContentClass::__clone ( )

Definition at line 176 of file ezcontentclass.php.

eZContentClass::adjustAttributePlacements ( attributes)

Definition at line 905 of file ezcontentclass.php.

Referenced by storeDefined().

eZContentClass::alwaysAvailableLanguage ( )

Wrapper for eZContentClassNameList::alwaysAvailableLanguage.

Returns:
'language' object.

Definition at line 1639 of file ezcontentclass.php.

eZContentClass::alwaysAvailableLanguageLocale ( )

Wrapper for eZContentClassNameList::alwaysAvailableLanguageLocale.

Returns:
'language' object.

Definition at line 1649 of file ezcontentclass.php.

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.

Definition at line 1415 of file ezcontentclass.php.

eZContentClass::canCreateLanguages ( )

Wrapper for eZContentClassNameList::untranslatedLanguages.

Definition at line 1621 of file ezcontentclass.php.

eZContentClass::canInstantiateClasses ( )

Definition at line 342 of file ezcontentclass.php.

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.

Definition at line 410 of file ezcontentclass.php.

Referenced by eZContentObjectTreeNode\getClassesJsArray().

eZContentClass::canInstantiateLanguages ( )

Definition at line 1482 of file ezcontentclass.php.

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

Definition at line 1723 of file ezcontentclass.php.

Referenced by 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

Definition at line 1752 of file ezcontentclass.php.

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

static eZContentClass::classIdentifiersHash ( ) [static, protected]

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

Definition at line 1771 of file ezcontentclass.php.

Referenced by classIDByIdentifier().

eZContentClass::clearAlwaysAvailableLanguageID ( )

Definition at line 1592 of file ezcontentclass.php.

eZContentClass::compareAttributes ( attr1,
attr2 
)

Definition at line 900 of file ezcontentclass.php.

eZContentClass::contentObjectName ( contentObject,
version = false,
translation = false 
)

Will generate a name for the content object based on the class settings for content object.

Definition at line 1380 of file ezcontentclass.php.

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.

Definition at line 209 of file ezcontentclass.php.

Referenced by eZContentClassPackageHandler\install(), and instantiate().

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

Definition at line 618 of file ezcontentclass.php.

eZContentClass::dataMap ( )

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

Definition at line 1295 of file ezcontentclass.php.

static eZContentClass::definition ( ) [static]
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.
  • set_functions - an associative array of attributes which maps to member functions, used for setting data with functions.
  • increment_key - the field which is incremented on table inserts.
  • class_name - the classname which is used for instantiating new objecs when fetching from the database.
  • sort - an associative array which defines the default sorting of lists, the key is the table field while the value is the sorting method which is either asc or desc.
  • name - the name of the database table

Example:

static function definition()
{
    return array( "fields" => array( "id" => "ID",
                                     "version" => "Version",
                                     "name" => "Name" ),
                  "keys" => array( "id", "version" ),
                  "function_attributes" => array( "current" => "currentVersion",
                                                  "class_name" => "className" ),
                  "increment_key" => "id",
                  "class_name" => "eZContentClass",
                  "sort" => array( "id" => "asc" ),
                  "name" => "ezcontentclass" );
}

Reimplemented from eZPersistentObject.

Definition at line 67 of file ezcontentclass.php.

Referenced by create(), exists(), fetch(), fetchByIdentifier(), fetchByRemoteID(), and fetchList().

static eZContentClass::exists ( id,
version = eZContentClass::VERSION_STATUS_DEFINED,
userID = false,
useIdentifier = false 
) [static]

Definition at line 1080 of file ezcontentclass.php.

Referenced by eZContentClassPackageHandler\handleParameters().

static eZContentClass::expireCache ( ) [static]

Expires in-memory cache for eZContentClass.

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

Since:
4.2

Definition at line 1846 of file ezcontentclass.php.

Referenced by eZCache\clearClassID(), and store().

eZContentClass::eZContentClass ( row)

Definition at line 47 of file ezcontentclass.php.

Referenced by create(), fetch(), fetchByIdentifier(), and fetchByRemoteID().

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.

Definition at line 692 of file ezcontentclass.php.

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()

Definition at line 729 of file ezcontentclass.php.

eZContentClass::fetchAttributeByIdentifier ( identifier,
asObject = true 
)

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

Parameters:
attributeidentifier.
Returns:
Class Attribute, null if none matched

Definition at line 1328 of file ezcontentclass.php.

eZContentClass::fetchAttributes ( id = false,
asObject = true,
version = eZContentClass::VERSION_STATUS_DEFINED 
)
static eZContentClass::fetchByIdentifier ( identifier,
asObject = true,
version = eZContentClass::VERSION_STATUS_DEFINED,
user_id = false,
parent_id = null 
) [static]
static eZContentClass::fetchByRemoteID ( remoteID,
asObject = true,
version = eZContentClass::VERSION_STATUS_DEFINED,
user_id = false,
parent_id = null 
) [static]
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()

Definition at line 657 of file ezcontentclass.php.

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()

Definition at line 644 of file ezcontentclass.php.

Referenced by fetchGroupIDList(), and storeDefined().

static eZContentClass::fetchIDListContainingDatatype ( dataTypeString) [static]

Returns an array of IDs of classes containing a specified datatype

Parameters:
$dataTypeStringa datatype identification string

Definition at line 1822 of file ezcontentclass.php.

Referenced by eZUser\contentClassIDs().

static eZContentClass::fetchList ( version = eZContentClass::VERSION_STATUS_DEFINED,
asObject = true,
user_id = false,
sorts = null,
fields = null,
classFilter = false,
limit = null 
) [static]
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.

Definition at line 677 of file ezcontentclass.php.

eZContentClass::fetchSearchableAttributes ( id = false,
asObject = true,
version = eZContentClass::VERSION_STATUS_DEFINED 
)

Definition at line 1340 of file ezcontentclass.php.

eZContentClass::hasNameInLanguage ( languageLocale)

Definition at line 1504 of file ezcontentclass.php.

eZContentClass::inGroup ( groupID)
Returns:
true if the class is part of the group $groupID

Definition at line 738 of file ezcontentclass.php.

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.

Definition at line 970 of file ezcontentclass.php.

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
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.

Definition at line 269 of file ezcontentclass.php.

Referenced by instantiateIn().

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

Definition at line 255 of file ezcontentclass.php.

eZContentClass::isRemovable ( )

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

See also:
removableInformation()

Definition at line 803 of file ezcontentclass.php.

Referenced by remove().

eZContentClass::languages ( )

Wrapper for eZContentClassNameList::languages.

Definition at line 1600 of file ezcontentclass.php.

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

Definition at line 630 of file ezcontentclass.php.

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.

Definition at line 1516 of file ezcontentclass.php.

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.

Definition at line 1499 of file ezcontentclass.php.

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

eZContentClass::nameList ( )

Definition at line 1655 of file ezcontentclass.php.

eZContentClass::objectCount ( )
Returns:
will return the number of objects published by this class.

Definition at line 1455 of file ezcontentclass.php.

eZContentClass::objectList ( )
Returns:
will return the list of objects published by this class.

Definition at line 1468 of file ezcontentclass.php.

eZContentClass::prioritizedLanguages ( )

Wrapper for eZContentClassNameList::prioritizedLanguages.

Definition at line 1608 of file ezcontentclass.php.

eZContentClass::prioritizedLanguagesJsArray ( )

Definition at line 1613 of file ezcontentclass.php.

eZContentClass::remoteID ( )

Get remote id of content node

Definition at line 768 of file ezcontentclass.php.

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.

Definition at line 821 of file ezcontentclass.php.

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()

Reimplemented from eZPersistentObject.

Definition at line 786 of file ezcontentclass.php.

eZContentClass::removeAttributes ( removeAttributes = false,
version = false 
)
Note:
Removes class attributes
Parameters:
removeAtttributesArray of attributes to remove
versionVersion to remove( optional )

Definition at line 864 of file ezcontentclass.php.

Referenced by remove(), and storeDefined().

static eZContentClass::removeTemporary ( ) [static]

Will remove all temporary classes from the database.

Definition at line 749 of file ezcontentclass.php.

eZContentClass::removeTranslation ( languageID)

Removes translated name for specified by $languageID language.

Definition at line 1663 of file ezcontentclass.php.

eZContentClass::setAlwaysAvailableLanguageID ( languageID,
updateChilds = true 
)

Definition at line 1532 of file ezcontentclass.php.

Referenced by clearAlwaysAvailableLanguageID().

eZContentClass::setCanInstantiateLanguages ( languageCodes)
Returns:
Sets the languages which are allowed to be instantiated for the class. Used only for the content/ fetch function.

Definition at line 1477 of file ezcontentclass.php.

eZContentClass::setName ( name,
languageLocale = false 
)

Definition at line 1521 of file ezcontentclass.php.

Referenced by initializeCopy().

eZContentClass::setVersion ( version,
set_childs = false 
)

Definition at line 1056 of file ezcontentclass.php.

Referenced by storeDefined().

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.

Definition at line 998 of file ezcontentclass.php.

eZContentClass::sync ( fieldFilters = null)

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

See also:
hasDirtyData
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.

Reimplemented from eZPersistentObject.

Definition at line 958 of file ezcontentclass.php.

Referenced by remoteID().

eZContentClass::topPriorityLanguageLocale ( )

Wrapper for eZContentClassNameList::topPriorityLanguageLocale.

Definition at line 1629 of file ezcontentclass.php.

Referenced by setName().

eZContentClass::urlAliasName ( contentObject,
version = false,
translation = false 
)

Definition at line 1394 of file ezcontentclass.php.

eZContentClass::versionCount ( )
Deprecated:
Returns:
The version count for the class if has been determined.

Definition at line 1371 of file ezcontentclass.php.

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

Definition at line 1861 of file ezcontentclass.php.

Referenced by eZContentObject\createNewVersion().

eZContentClass::versionStatus ( )

Definition at line 1353 of file ezcontentclass.php.


Member Data Documentation

eZContentClass::$AllGroups

Definition at line 1948 of file ezcontentclass.php.

eZContentClass::$CanInstantiateLanguages

Definition at line 1950 of file ezcontentclass.php.

eZContentClass::$ContentObjectName

Definition at line 1940 of file ezcontentclass.php.

eZContentClass::$Created

Definition at line 1945 of file ezcontentclass.php.

eZContentClass::$CreatorID

Definition at line 1943 of file ezcontentclass.php.

eZContentClass::$ID

Definition at line 1934 of file ezcontentclass.php.

eZContentClass::$Identifier

Definition at line 1939 of file ezcontentclass.php.

eZContentClass::$identifierHash = null [static, private]

In-memory cache for class identifiers / id matching.

Definition at line 1956 of file ezcontentclass.php.

Referenced by classIDByIdentifier(), classIdentifierByID(), and classIdentifiersHash().

eZContentClass::$InGroups

Definition at line 1947 of file ezcontentclass.php.

eZContentClass::$IsContainer

Definition at line 1949 of file ezcontentclass.php.

eZContentClass::$LanguageMask

Definition at line 1951 of file ezcontentclass.php.

eZContentClass::$Modified

Definition at line 1946 of file ezcontentclass.php.

eZContentClass::$ModifierID

Definition at line 1944 of file ezcontentclass.php.

eZContentClass::$NameList

Definition at line 1938 of file ezcontentclass.php.

eZContentClass::$SerializedNameList

Definition at line 1936 of file ezcontentclass.php.

eZContentClass::$Version

Definition at line 1941 of file ezcontentclass.php.

eZContentClass::$VersionCount

Definition at line 1942 of file ezcontentclass.php.

Definition at line 45 of file ezcontentclass.php.

Referenced by versionStatus().


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