Documentation

Node extends EntityBase

Node

Tags
copyright

CLOUDREXX CMS - CLOUDREXX AG

author

CLOUDREXX Development Team info@cloudrexx.com

subpackage

core_contentmanager

Table of Contents

Properties

$localeCodes  : array<string|int, mixed>
List of locale codes ordered by translation fallback order per Cx instance
$nestingCount  : int
Counts the nesting level of __call()
$stringRepresentationBlank  : bool
Whether blank string representations are valid
$stringRepresentationFields  : array<string|int, mixed>
List of fields that should be available in the string representation
$stringRepresentationFormat  : string
Sprintf format for the string representation
$validators  : array<string|int, mixed>
Initialize this array as follows: array( 'columName' => Zend_Validate )
$virtual  : bool
Defines if an entity is virtual and therefore not persistable.
$children  : Collection
$id  : int
$instance  : mixed
$instanceCounter  : mixed
$lft  : int
$lvl  : int
$pages  : Collection
$parent  : Node
$rgt  : int

Methods

__call()  : mixed
Route methods like getName(), getType(), getDirectory(), etc.
__construct()  : mixed
__get()  : mixed
This is an ugly solution to allow $this->cx to be available in all entity classes Since the entity's constructor is not called when an entity is loaded from DB this cannot be assigned there.
__toString()  : string
Returns this entity's identifying value
addChild()  : Node
Add children
addChildren()  : mixed
Add children
addPage()  : mixed
Add a page
addParsedChild()  : mixed
copy()  : Node
Creates a copy of this node including its pages
getChildren()  : Collection
Get children
getComponentController()  : SystemComponent
Returns the component controller for this component
getId()  : int
Get id
getKeyAsString()  : string
Returns this entity's key
getLft()  : int
Get lft
getLvl()  : int
Get lvl
getPage()  : Page
Get a certain Page
getPages()  : Collection
Get pages
getPagesByLang()  : mixed
getParent()  : Node
Get parent
getRgt()  : int
Get rgt
getTranslatedFieldValue()  : mixed
Returns the value of a translatable field using fallback mechanisms
getUniqueIdentifier()  : string
Returns an unique identifier that is usable even if no id is set yet.
hasAccessByUserId()  : bool
Check whether the current user has access to this node.
initializeValidators()  : mixed
Set $this->validators
isChildOf()  : bool
Check if this node is a child (direct or indirect) of node $parent
isVirtual()  : bool
Returns the virtuality of the entity
removeChild()  : mixed
Remove children
removePage()  : mixed
Remove pages
setId()  : mixed
Set id
setLft()  : mixed
Set lft
setLvl()  : mixed
Set lvl
setParent()  : mixed
Set parent
setRgt()  : mixed
Set rgt
setVirtual()  : mixed
Set the virtuality of the entity
translatePage()  : mixed
Creates a translated page in this node
validate()  : mixed
getFallbackLocaleCodes()  : array<string|int, mixed>
Returns a list of all locale codes ordered by fallback order
getStringRepresentationBlank()  : bool
Whether blank string representations are valid
getStringRepresentationFields()  : array<string|int, mixed>
Returns a list of fields available in the string representation
getStringRepresentationFormat()  : string
Returns the sprintf() format for the string representation

Properties

$localeCodes

List of locale codes ordered by translation fallback order per Cx instance

protected static array<string|int, mixed> $localeCodes = array()

Array in the form: array(<instanceId> => array(<localeCode>, ...))

Tags
see
getFallbackLocaleCodes()

$nestingCount

Counts the nesting level of __call()

protected static int $nestingCount = 0

$stringRepresentationBlank

Whether blank string representations are valid

protected bool $stringRepresentationBlank = false

Whether blank string representations are valid

Tags
see
getStringRepresentationBlank()

$stringRepresentationFields

List of fields that should be available in the string representation

protected array<string|int, mixed> $stringRepresentationFields = array()

List of field names

Tags
see
getStringRepresentationFields()

$stringRepresentationFormat

Sprintf format for the string representation

protected string $stringRepresentationFormat = ''

Sprintf format string

Tags
see
getStringRepresentationFormat()

$validators

Initialize this array as follows: array( 'columName' => Zend_Validate )

protected array<string|int, mixed> $validators = array()

$virtual

Defines if an entity is virtual and therefore not persistable.

protected bool $virtual = false

Defaults to FALSE - not virtual.

$instanceCounter

private static mixed $instanceCounter = 0

Methods

__call()

Route methods like getName(), getType(), getDirectory(), etc.

public __call(string $methodName, array<string|int, mixed> $arguments) : mixed
Parameters
$methodName : string

Name of method to call

$arguments : array<string|int, mixed>

List of arguments for the method to call

Tags
throws
Exception

If __call() nesting level reaches 20

Attributes
#[ReturnTypeWillChange]
Return values
mixed

Return value of the method to call

__get()

This is an ugly solution to allow $this->cx to be available in all entity classes Since the entity's constructor is not called when an entity is loaded from DB this cannot be assigned there.

public __get(mixed $name) : mixed
Parameters
$name : mixed
Attributes
#[ReturnTypeWillChange]

__toString()

Returns this entity's identifying value

public __toString() : string

By default this returns the same as getKeyAsString(), but this method might get overridden by subclasses.

Return values
string

Identifying value for this entity

addChildren()

Add children

public addChildren(Node $children) : mixed
Parameters
$children : Node

copy()

Creates a copy of this node including its pages

public copy([bool $recursive = false ][, Node $newParent = null ][, int &$nodePosition = 0 ][, bool $addCopySuffix = false ]) : Node
Parameters
$recursive : bool = false

(optional) Whether copy all children to the new node or not, default false

$newParent : Node = null

(optional) New parent node for the copy, default is parent of this

$nodePosition : int = 0

Node position

$addCopySuffix : bool = false

Add the suffix '(Copy)' to the page title if true otherwise not

Return values
Node

Copy of this node

getChildren()

Get children

public getChildren([mixed $lang = null ]) : Collection
Parameters
$lang : mixed = null
Return values
Collection

$children

getId()

Get id

public getId() : int
Return values
int

$id

getKeyAsString()

Returns this entity's key

public final getKeyAsString([string $separator = '/' ]) : string

If this entity has a composite key, the fields are separated by $separator.

Parameters
$separator : string = '/'

(optional) Separator for composite key fields, default "/"

Return values
string

Entity key as string

getLft()

Get lft

public getLft() : int
Return values
int

$lft

getLvl()

Get lvl

public getLvl() : int
Return values
int

$lvl

getPage()

Get a certain Page

public getPage(int $lang) : Page
Parameters
$lang : int
Return values
Page

getPages()

Get pages

public getPages([mixed $inactive_langs = false ][, mixed $aliases = false ]) : Collection
Parameters
$inactive_langs : mixed = false
$aliases : mixed = false
Return values
Collection

$pages

getPagesByLang()

public getPagesByLang([mixed $inactive_langs = false ]) : mixed
Parameters
$inactive_langs : mixed = false

getRgt()

Get rgt

public getRgt() : int
Return values
int

$rgt

getTranslatedFieldValue()

Returns the value of a translatable field using fallback mechanisms

public getTranslatedFieldValue(string $fieldName) : mixed

If the field is not translatable its value is returned anyway. Tries to return the value in the following locales (if non-empty):

  • Current locale
  • Default locale
  • All other locales
Parameters
$fieldName : string

Name of a translatable field

getUniqueIdentifier()

Returns an unique identifier that is usable even if no id is set yet.

public getUniqueIdentifier() : string

The Cx\Model\Events\PageEventListener uses this.

Return values
string

hasAccessByUserId()

Check whether the current user has access to this node.

public hasAccessByUserId([bool $frontend = true ]) : bool
Parameters
$frontend : bool = true

whether front- or backend. defaults to frontend

Return values
bool

initializeValidators()

Set $this->validators

public initializeValidators() : mixed

Validators can be found in lib/FRAMEWORK/Validator.class.php These will be executed if validate() is called

isChildOf()

Check if this node is a child (direct or indirect) of node $parent

public isChildOf(Node $parent) : bool
Parameters
$parent : Node

Node to check if its the parent of this instance of

Return values
bool

Whether this instance is a child of $parent. Whereas $parent is not required to be a direct parent of this instance.

isVirtual()

Returns the virtuality of the entity

public isVirtual() : bool
Return values
bool

TRUE if the entity is virtual, otherwise FALSE

removeChild()

Remove children

public removeChild(Node $children) : mixed
Parameters
$children : Node

removePage()

Remove pages

public removePage(Page $pages) : mixed
Parameters
$pages : Page

setId()

Set id

public setId(int $id) : mixed
Parameters
$id : int

setLft()

Set lft

public setLft(int $lft) : mixed
Parameters
$lft : int

setLvl()

Set lvl

public setLvl(int $lvl) : mixed
Parameters
$lvl : int

setParent()

Set parent

public setParent(Node $parent) : mixed

This intentionally does not allow to set parent to NULL. Making an existing node a root node is not supported. To create a new root node simply create a new entity as the default value for $this->parent is NULL.

Parameters
$parent : Node

setRgt()

Set rgt

public setRgt(int $rgt) : mixed
Parameters
$rgt : int

setVirtual()

Set the virtuality of the entity

public setVirtual(bool $virtual) : mixed
Parameters
$virtual : bool

TRUE to set the entity as virtual or otherwise to FALSE

translatePage()

Creates a translated page in this node

public translatePage(bool $activate, int $targetLang[, bool $persist = true ]) : mixed

Does not flush EntityManager.

Parameters
$activate : bool

whether the new page should be activated

$targetLang : int

target language id

$persist : bool = true

Set to false to not persist any newly created pages to the database. Those pages will be set as virtual (Page::setVirtual()).

Tags
returns

\Cx\Core\ContentManager\Model\Entity\Page the copy

validate()

public validate() : mixed
Tags
prePersist

getFallbackLocaleCodes()

Returns a list of all locale codes ordered by fallback order

protected getFallbackLocaleCodes() : array<string|int, mixed>
  • First entry is the current locale
  • Second entry is the default locale (if different from current, it's omitted otherwise)
  • Then all other locales follow (in no particular order)
Tags
todo

Order the array by the fallback order (same as in ContentManager)

Return values
array<string|int, mixed>

List of locale codes

getStringRepresentationBlank()

Whether blank string representations are valid

protected getStringRepresentationBlank() : bool
Return values
bool

Whether blank string representations are valid

getStringRepresentationFields()

Returns a list of fields available in the string representation

protected getStringRepresentationFields() : array<string|int, mixed>
Return values
array<string|int, mixed>

List of field names

getStringRepresentationFormat()

Returns the sprintf() format for the string representation

protected getStringRepresentationFormat() : string
Return values
string

sprintf() format string


        
On this page

Search results