abstract class AbstractNodeData (View source)

Some NodeData (persisted or transient)

NOTE: This class is not supposed to be subclassed by userland code. If this API is modified, make sure to also implement the additional methods inside NodeData, NodeTemplate and Node and keep NodeInterface in sync!

Properties

protected array $properties

Properties of this Node

protected ContentObjectProxy $contentObjectProxy

An optional object which is used as a content container alternative to $properties

protected string $nodeType

The name of the node type of this node

protected DateTimeInterface $creationDateTime
protected DateTimeInterface $lastModificationDateTime
protected DateTimeInterface $lastPublicationDateTime
protected bool $hidden

If this node is hidden, it is not shown in a public place

protected DateTimeInterface $hiddenBeforeDateTime

If set, this node is automatically hidden before the specified date / time

protected DateTimeInterface $hiddenAfterDateTime

If set, this node is automatically hidden after the specified date / time

protected bool $hiddenInIndex

If this node should be hidden in indexes, such as a website navigation

protected string[] $accessRoles

List of role names which are required to access this node at all

protected NodeDataRepository $nodeDataRepository
protected PersistenceManagerInterface $persistenceManager
protected NodeTypeManager $nodeTypeManager

Methods

__construct()

Constructs this node data container

void
ensurePropertiesIsNeverNull()

Make sure the properties are always an array.

void
setProperty(string $propertyName, mixed $value)

Sets the specified property.

persistRelatedEntities(mixed $value)

Checks if a property value contains an entity and persists it.

bool
hasProperty(string $propertyName)

If this node has a property with the given name.

mixed
getProperty(string $propertyName)

Returns the specified property.

void
removeProperty(string $propertyName)

Removes the specified property.

array
getProperties()

Returns all properties of this node.

array
getPropertyNames()

Returns the names of all properties of this node.

void
setContentObject(object $contentObject)

Sets a content object for this node.

object
getContentObject()

Returns the content object of this node (if any).

void
unsetContentObject()

Unsets the content object of this node.

void
setNodeType(NodeType $nodeType)

Sets the node type of this node.

getNodeType()

Returns the node type of this node.

getCreationDateTime()

No description

void
setLastPublicationDateTime(DateTimeInterface $lastPublicationDateTime = null)

No description

void
setHidden(bool $hidden)

Sets the "hidden" flag for this node.

bool
isHidden()

Returns the current state of the hidden flag

void
setHiddenBeforeDateTime(DateTimeInterface $dateTime = null)

Sets the date and time when this node becomes potentially visible.

getHiddenBeforeDateTime()

Returns the date and time before which this node will be automatically hidden.

void
setHiddenAfterDateTime(DateTimeInterface $dateTime = null)

Sets the date and time when this node should be automatically hidden

getHiddenAfterDateTime()

Returns the date and time after which this node will be automatically hidden.

void
setHiddenInIndex(bool $hidden)

Sets if this node should be hidden in indexes, such as a site navigation.

bool
isHiddenInIndex()

If this node should be hidden in indexes

void
setAccessRoles(array $accessRoles)

Sets the roles which are required to access this node

array
getAccessRoles()

Returns the names of defined access roles

void
addOrUpdate()

By default this method does not do anything.

void
updateContentObject(object $contentObject)

By default this method does not do anything.

getWorkspace()

Returns the workspace this node is contained in

Details

__construct()

Constructs this node data container

void ensurePropertiesIsNeverNull()

Make sure the properties are always an array.

If the JSON in the DB is corrupted, decoding it can fail, leading to a null value. This may lead to errors later, when the value is used with functions that expect an array.

Return Value

void

void setProperty(string $propertyName, mixed $value)

Sets the specified property.

If the node has a content object attached, the property will be set there if it is settable.

Parameters

string $propertyName

Name of the property

mixed $value

Value of the property

Return Value

void

protected persistRelatedEntities(mixed $value)

Checks if a property value contains an entity and persists it.

Parameters

mixed $value

bool hasProperty(string $propertyName)

If this node has a property with the given name.

If the node has a content object attached, the property will be checked there.

Parameters

string $propertyName

Name of the property to test for

Return Value

bool

mixed getProperty(string $propertyName)

Returns the specified property.

If the node has a content object attached, the property will be fetched there if it is gettable.

Parameters

string $propertyName

Name of the property

Return Value

mixed

value of the property

Exceptions

NodeException

void removeProperty(string $propertyName)

Removes the specified property.

If the node has a content object attached, the property will not be removed on that object if it exists.

Parameters

string $propertyName

Name of the property

Return Value

void

Exceptions

NodeException

array getProperties()

Returns all properties of this node.

If the node has a content object attached, the properties will be fetched there.

Return Value

array

Property values, indexed by their name

array getPropertyNames()

Returns the names of all properties of this node.

Return Value

array

Property names

void setContentObject(object $contentObject)

Sets a content object for this node.

Parameters

object $contentObject

The content object

Return Value

void

Exceptions

InvalidArgumentException

object getContentObject()

Returns the content object of this node (if any).

Return Value

object

The content object or NULL if none was set

void unsetContentObject()

Unsets the content object of this node.

Return Value

void

void setNodeType(NodeType $nodeType)

Sets the node type of this node.

Parameters

NodeType $nodeType

Return Value

void

NodeType getNodeType()

Returns the node type of this node.

Return Value

NodeType

Exceptions

NodeTypeNotFoundException

DateTime getCreationDateTime()

No description

Return Value

DateTime

DateTime getLastModificationDateTime()

No description

Return Value

DateTime

DateTimeInterface getLastPublicationDateTime()

No description

Return Value

DateTimeInterface

void setLastPublicationDateTime(DateTimeInterface $lastPublicationDateTime = null)

No description

Parameters

DateTimeInterface $lastPublicationDateTime

Return Value

void

void setHidden(bool $hidden)

Sets the "hidden" flag for this node.

Parameters

bool $hidden

If true, this Node will be hidden

Return Value

void

bool isHidden()

Returns the current state of the hidden flag

Return Value

bool

void setHiddenBeforeDateTime(DateTimeInterface $dateTime = null)

Sets the date and time when this node becomes potentially visible.

Parameters

DateTimeInterface $dateTime

Date before this node should be hidden

Return Value

void

DateTimeInterface getHiddenBeforeDateTime()

Returns the date and time before which this node will be automatically hidden.

Return Value

DateTimeInterface

Date before this node will be hidden or NULL if no such time was set

void setHiddenAfterDateTime(DateTimeInterface $dateTime = null)

Sets the date and time when this node should be automatically hidden

Parameters

DateTimeInterface $dateTime

Date after which this node should be hidden or NULL if no such time was set

Return Value

void

DateTimeInterface getHiddenAfterDateTime()

Returns the date and time after which this node will be automatically hidden.

Return Value

DateTimeInterface

Date after which this node will be hidden

void setHiddenInIndex(bool $hidden)

Sets if this node should be hidden in indexes, such as a site navigation.

Parameters

bool $hidden

true if it should be hidden, otherwise false

Return Value

void

bool isHiddenInIndex()

If this node should be hidden in indexes

Return Value

bool

void setAccessRoles(array $accessRoles)

Sets the roles which are required to access this node

Parameters

array $accessRoles

Return Value

void

Exceptions

InvalidArgumentException

array getAccessRoles()

Returns the names of defined access roles

Return Value

array

protected void addOrUpdate()

By default this method does not do anything.

For persisted nodes (PersistedNodeInterface) this updates the node in the node repository, for new nodes this method will add the respective node to the repository.

Return Value

void

protected void updateContentObject(object $contentObject)

By default this method does not do anything.

For persisted nodes (PersistedNodeInterface) this updates the content object via the PersistenceManager

Parameters

object $contentObject

Return Value

void

abstract Workspace getWorkspace()

Returns the workspace this node is contained in

Return Value

Workspace