Package DE_EPAGES::Object::API::Object::Object
object interface for Object. Includes methods for accessing attributes, child objects, and parents. Serialization is supported via XML import/export.
Base |
DE_EPAGES::Object::API::Object::DALObject |
Example |
my $Object = LoadObject( $ObjectID ); print $Object->class->alias; print $Object->path; $Object->set( { 'LastName' => 'Watson' } ); print $Object->get( 'LastName' ); $Object->delete; |
Functions
- alias
- child
- children
- childrenByClass
- className
- classTemplate
- clearSavedPages
- clone
- cloneChildren
- cloneFiles
- dbPackage
- deleteChildren
- deleteFiles
- deleteSelf
- deleteXML
- existsChild
- exportXMLAttributes
- exportXMLChildElements
- exportXMLElements
- exportableAttributes
- exportableChildren
- filePath
- findChild
- findChildren
- findParent
- findParentPath
- findPath
- findXML
- folder
- get
- getSite
- hasChildren
- importXML
- insertChild
- isAllowedChild
- isChildOf
- isParentOf
- load
- nextAlias
- nextPosition
- pageCacheDuration
- pageCacheMaxAge
- parent
- parentByClass
- parentPath
- path
- pathString
- planXMLExport
- recursiveGet
- relativePath
- renumberChildren
- reset
- savePage
- set
- templatePath
- uniqueChildAlias
- updatePageCache
- useFilePathPart
alias
Returns the alias of an object
Syntax |
$Alias = $Object->alias; |
Return |
|
child
Returns the direct child object with the given alias name. Throws an error if no such child object exists.
Syntax |
$ChildObject = $Object->child( $Alias ); |
Input |
|
Return |
|
children
Returns all direct child objects ordered by Position.
Syntax |
$aChildObjects = $Object->children; |
Return |
|
childrenByClass
Returns all direct child objects that are instances of the given class.
Syntax |
$aChildObjects = $Object->childrenByClass($Class); $aChildObjects = $Object->childrenByClass($ClassAlias); |
Input |
|
Return |
|
className
Returns the class name, used for DAL access.
Syntax |
$ClassName = $Object->className; |
Return |
|
classTemplate
This function is used to overwrite the given template for the purpose that each content object can defined there own template (visualisation).
Syntax |
$Name = $Object->classTemplate($Name, $ObjectPageType); |
Input |
|
Return |
|
clearSavedPages
Clears the saved pages of object. See also: DE_EPAGES::Presentation::API::TLE::IncludeTemplateHandler::SavedInclude
Syntax |
$Shop->clearSavedPages(); |
clone
Inserts a new object into the database as copy from old object.
Syntax |
$Clone = $Object->clone( $hInfo ); $Clone = $Object->clone( $hInfo, $Recursive ); |
Input |
|
Return |
|
cloneChildren
Returns all children of the object which should be cloned.
Syntax |
$aChildren = $Object->cloneChildren |
Example |
$Description = $Object->cloneChildren; |
Return |
|
cloneFiles
Copies directories (PublicPath and PrivatePath) from original object to the clone. This function will is called by clone.
Syntax |
$Object->cloneFiles( $Clone ); |
Input |
|
dbPackage
Returns the database package, used for DAL access.
Syntax |
$DbPackage = $Object->dbPackage; |
Return |
|
deleteChildren
Deletes all child objects of this object.
Syntax |
$Object->deleteChildren; |
deleteFiles
Deletes the directories PublicPath, PrivatePath. If Site.IsFilePathPartUsed and defined FilePathPart the directories will not deleted. Delete the directory StaticPath.
Syntax |
$Object->deleteFiles; |
deleteSelf
Deletes the object from database tables. Called by delete.
Syntax |
$Object->deleteSelf; |
deleteXML
Called by the SAX driver when a start tag for the current object class is encountered. The function identifies the object by the attributes in $hAttributes and deletes the object if it still exists and and the attribute 'delete="1"' is specified.
Syntax |
$Object = DE_EPAGES::Object::API::Object::Object->deleteXML($Handler, $hElement, $hAttributes); |
Input |
|
Return |
|
existsChild
Returns true if the direct child object with the given alias name exists.
Syntax |
$Exists = $Object->existsChild( $Alias ); |
Return |
|
exportXMLAttributes
Returns plain attributes of object to XML export driver. This function removes localized attributes (deletes attribues like ParentID, Inherit if default (1), Class if equal TagName).
Syntax |
$hAttributes = $Object->exportXMLAttributes( $Driver, $hAllAttributes ); |
Input |
|
Return |
|
exportXMLChildElements
Add xml elements for children (asks each with planXMLExport to add to driver).
Syntax |
$Object->exportXMLChildElements( $Driver, $hAttributes ); |
Input |
|
exportXMLElements
Exports multilinguagal attribute value of this object to the xml SAX driver.
Syntax |
$Object->exportXMLElements($Driver, $hAllAttributes); |
Input |
|
exportableAttributes
Returns all attribute values that have an existing (not-null) value. Unlike $Object->_attributes this function returns localized attribute values as hash reference (language id => value).
Syntax |
$hValues = $Object->exportableAttributes |
Example |
$Description = $Object->exportableAttributes; |
Return |
|
exportableChildren
Returns all children of the object which should be exported.
Syntax |
$aChildren = $Object->exportableChildren |
Example |
$Description = $Object->exportableChildren; |
Return |
|
filePath
Joins FilePath of site and FileAlias of this object.
Syntax |
$Path = $Object->filePath; |
Return |
|
findChild
Returns the object id of a child object or undef if the child alias does not exist.
Syntax |
$ChildObjectID = $Object->findChild( $Alias ); |
Input |
|
Return |
|
findChildren
Returns a list of all child object ids of an object ordered by Position.
Syntax |
$aChildObjectIDs = $Object->findChildren; |
Return |
|
findParent
Returns the direct parent object identifier, Only the System object will return undef, because it does not have a parent object.
Syntax |
$ParentID = $Object->findParent; |
Return |
|
findParentPath
Returns the path of object identifier from the system root to this object. The System object is the first list item and this object is the last item in the list.
Syntax |
$aParentIDs = $Object->findParentPath; |
Return |
|
findPath
find the object via path started from current object. the path can be absolute "/Object1/Object2" or relative "Store/Catalog/Product" to the object.
Syntax |
$ObjectID = $Object->findPath($Path); |
Input |
|
Return |
|
findXML
Returns object identifier if the attributes matches. if no object match the function returns undef
Syntax |
$ObjectID = $Object->findXML( $hAttributes ) |
Example |
my $ObjectID = $Object->findXML( { 'GUID' => '12345' } ); |
Input |
|
Return |
|
folder
Returns the child object by alias name. If the child object does not exist, a new one is created with the given alias and class 'Object'.
Syntax |
$Folder = $Object->folder( $Alias ); $Folder = $Object->folder( $Alias, $hInfo ); |
Example |
$Orders = $Shop->folder( 'Orders' ); $Orders = $Shop->folder( 'Orders', { 'Position' => 50 } ); |
Input |
|
Return |
|
get
Returns one or more attribute values.
Syntax |
$Value = $Object->get( $Name, $LanguageID ); $hValues = $Object->get( $aNames, $LanguageID ); |
Example |
$Password = $Object->get( 'Password' ); $hCredentials = $Object->get( ['Login', 'Password'] ); printf "Login: %s\n", $hCredentials->{'Login'}; printf "Password: %s\n", $hCredentials->{'Password'}; |
Input |
|
Return |
|
getSite
Returns the site of an object
Syntax |
$Site = $Object->getSite; |
Return |
|
hasChildren
Returns true if the the object has children.
Syntax |
$Has = $Object->hasChildren; |
Return |
|
importXML
Imports an object from an XML file. This function is called at the XML start tag. The end tag triggers the importXMLEnd function.
Syntax |
$Object = DE_EPAGES::Object::API::Object::Object->importXML($Handler, $hElement, $Class, $hAttributes); |
Input |
|
Return |
|
insertChild
Inserts a new object with the current object as parent.
Syntax |
$NewObject = $Object->insertChild( $Class, $hInfo ); $NewObject = $Object->insertChild( $ClassAlias, $hInfo ); |
Example |
$NewObject = $Object->insertChild( 'User', { Alias => $Login } ); |
Input |
|
Return |
|
isAllowedChild
Returns if an Object could be the parent of a PossibleChild.
Syntax |
$isAllowed = $Object->isAllowedChild($PossibleChild); |
Return |
|
isChildOf
Returns whether an Object is a child (direct or indirect) of a PossibleParent.
Syntax |
$isChild = $Object->isChildOf($PossibleParent); |
Return |
|
isParentOf
Returns if an Object is a parent (direct or indirect) of a PossibleChild.
Syntax |
$isParent = $Object->isParentOf($PossibleChild); |
Return |
|
load
Loads an existing object.
Syntax |
$Object = DE_EPAGES::Object::API::Object->load( $ObjectID ); Note: Use <function DE_EPAGES::Object::API::Factory::LoadObject> instead. |
Input |
|
Return |
|
nextAlias
Returns the an the next unused alias for a new object using a format pattern.
Syntax |
$Alias = $Object->nextAlias; $Alias = $Object->nextAlias( $Format ); |
Example |
$Alias = $Object->nextAlias( "P_%s" ); |
Input |
|
Return |
|
nextPosition
Returns the next (top) position for a new child. Such as, if the last child has Position = 150 the method returns 160 (if PositionStep is 10).
Syntax |
$Position = $Object->nextPosition($LastPosition); |
Input |
|
Return |
|
pageCacheDuration
How long a page can be cached.
Syntax |
$PageCache = $Object->pageCacheDuration; |
Return |
|
pageCacheMaxAge
How long a page can be cached on client.
Syntax |
$PageCache = $Object->pageCacheMaxAge; |
Return |
|
parent
Returns the direct parent object, Only the System object will return undef, because it does not have a parent object.
Syntax |
$ParentObject = $Object->parent; |
Return |
|
parentByClass
Returns a parent object which is instance of class.
Syntax |
$Object = $Object->parentByClass($Class); $Object = $Object->parentByClass($ClassAlias); |
Example |
$Shop = $Object->parentByClass( LoadClassByAlias('Shop') ); |
Input |
|
Return |
|
parentPath
Returns the path of objects from the system root to this object. The System object is the first list item and this object is the last item in the list.
Syntax |
$aParentObjects = $Object->parentPath; |
Return |
|
path
find the object via path started from current object. the path can be absolute "/Object1/Object2" or relative "Store/Catalog/Product" to the object.
Syntax |
$PathObject = $Object->path($Path); |
Example |
$User = $Order->path('../../Users/max_mustermann'); |
Input |
|
Return |
|
pathString
Returns the path of object as a string joined with '/'.
Syntax |
$Path = $Object->pathString; |
Return |
|
planXMLExport
Add this object to driver (possible for nextLevel).
Syntax |
$Object->planXMLExport( $Driver ); |
Input |
|
recursiveGet
Obsolete. Do not use.
relativePath
Returns the relative path of an object to another object.
Syntax |
$relativePath = $Object->relativePath($Object2); |
Example |
$Object1 = LoadObjectByPath('/Shops/DemoShop/Products/be_40401/SubProducts/be_4040104005'); $Object2 = LoadObjectByPath('/Shops/DemoShop/Customers'); ok( $Object1->relativePath($Object2) eq '../../../../Customers' ); ok( $Object2->relativePath($Object1) eq '../Products/be_40401/SubProducts/be_4040104005' ); |
Input |
|
Return |
|
renumberChildren
Updates the Position attribute of all child objects with a distance of 10 between subsequent objects. The new position number will be 10, 20, ....
Syntax |
$Object->renumberChildren; |
reset
if an attribute was created or removed the class must be reset
Syntax |
$Object->reset; |
savePage
Save cache of actual object in File. Use static path of actual object. To save cache file the function will need a unique cachekey, this key is integrated in filename. Also a function to compute the content is needed. Content is computed if no cachefile exist.
Syntax |
$Content = $Shop->savePage($CacheKey, $FallBackSub); |
Example |
$Content = $Shop->savePage('MBO.Menu_de', sub{ return join '', @{$Processor->replaceTLEs($cTemplate)}; }); |
Input |
|
Return |
|
set
Sets the given attribute values on the object. This function triggers hooks 'OBJ_BeforeUpdateObject' and 'OBJ_AfterUpdateObject' and any specialized OBJ_BeforeUpdate* and OBJ_AfterUpdate* hooks.
Syntax |
$Object->set($hValues, $LanguageID); |
Example |
$Object->set({ 'LocaleID' => 'de_DE' }); $Object->set({ 'Name' => 'Fußball' }, GetPKeyLanguageByCode('de')); $Object->set({ 'Name' => 'Soccer' }, GetPKeyLanguageByCode('en')); |
Input |
|
Hook |
|
templatePath
This function return a list of objects which can define the used templates.
Syntax |
$aObjects = $Object->templatePath; |
Return |
|
uniqueChildAlias
Returns a safe (no special chars) alias for a given string and makes it unique by adding a counter, if an element with this alias already exists.
Syntax |
$UniqueAlias = $Object->uniqueChildAlias( $String, $AllowedAlias ); |
Example |
$UniqueAlias = $Object->uniqueChildAlias( 'my 5$-bill' ); $UniqueAlias = $Object->uniqueChildAlias( 'my 10$-bill', 'my_10_bill' ); |
Input |
|
Return |
|
updatePageCache
Updates page cache date of the object's site if the object is an instance of one of the pre-defined classes (this classes implement invalidatePageCache method). These classes influence the content which is shown on storefront pages.
Syntax |
$Object->updatePageCache; |
useFilePathPart
This function return 0 as default for all objects. Mainly used for MediaGallery.
Syntax |
$useFilePathPart = $Object->useFilePathPart; |
Return |
|