class NodeHandler (View source)

Handle operations with nodes entities.

Methods

getNode()

No description

$this
setNode(Node $node)

No description

__construct(Node $node)

Create a new node handler with node to handle.

$this
cleanCustomFormsFromField(NodeTypeField $field, bool $flush = true)

Remove every node to custom-forms associations for a given field.

$this
addCustomFormForField(CustomForm $customForm, NodeTypeField $field, bool $flush = true, null|integer $position = null)

Add a node to current custom-forms for a given node-type field.

array
getCustomFormsFromFieldName(string $fieldName)

Get custom forms linked to current node for a given fieldname.

$this
cleanNodesFromField(NodeTypeField $field, bool $flush = true)

Remove every node to node associations for a given field.

$this
addNodeForField(Node $node, NodeTypeField $field, bool $flush = true, null|integer $position = null)

Add a node to current node for a given node-type field.

ArrayCollection
getNodesFromFieldName(string $fieldName)

Get nodes linked to current node for a given fieldname.

ArrayCollection
getReverseNodesFromFieldName(string $fieldName)

Get nodes reversed-linked to current node for a given fieldname.

getNodeSourceByTranslation(Translation $translation)

Get node source by translation.

$this
removeAssociations()

Remove only current node associations.

$this
removeWithChildrenAndAssociations()

Remove current node with its children recursively and its associations.

$this
softRemoveWithChildren()

Soft delete node and its children.

$this
softUnremoveWithChildren()

Un-delete node and its children.

$this
publishWithChildren()

Publish node and its children.

$this
archiveWithChildren()

Archive node and its children.

getAvailableTranslations()

Alias for NodeRepository::findAvailableTranslationForNode.

array
getAvailableTranslationsId()

Alias for NodeRepository::findAvailableTranslationIdForNode.

array
getUnavailableTranslations()

Alias for NodeRepository::findUnavailableTranslationForNode.

array
findUnavailableTranslationIdForNode()

Alias for NodeRepository::findUnavailableTranslationIdForNode.

bool
isRelatedToNewsletter()

Return if is in Newsletter Node.

bool
isRelatedToNode(Node $relative)

Return if part of Node offspring.

array
getParents(TokenStorageInterface $tokenStorage = null)

Return every node’s parents

int
cleanPositions(bool $setPositions = true)

Clean position for current node siblings.

int
cleanChildrenPositions(bool $setPositions = true)

Reset current node children positions.

static int
cleanRootNodesPositions(bool $setPositions = true)

Reset every root nodes positions.

array
getAllOffspringId()

Return all node offspring id.

$this
makeHome()

Set current node as the Home node.

duplicate() deprecated

Duplicate current node with all its children.

getPrevious(array $criteria = null, array $order = null, AuthorizationChecker $authorizationChecker = null, boolean $preview = false)

Get previous node from hierarchy.

getNext(array $criteria = null, array $order = null, AuthorizationChecker $authorizationChecker = null, boolean $preview = false)

Get next node from hierarchy.

Details

Node getNode()

Return Value

Node

$this setNode(Node $node)

Parameters

Node $node

Return Value

$this

__construct(Node $node)

Create a new node handler with node to handle.

Parameters

Node $node

$this cleanCustomFormsFromField(NodeTypeField $field, bool $flush = true)

Remove every node to custom-forms associations for a given field.

Parameters

NodeTypeField $field
bool $flush

Return Value

$this

$this addCustomFormForField(CustomForm $customForm, NodeTypeField $field, bool $flush = true, null|integer $position = null)

Add a node to current custom-forms for a given node-type field.

Parameters

CustomForm $customForm
NodeTypeField $field
bool $flush
null|integer $position

Return Value

$this

array getCustomFormsFromFieldName(string $fieldName)

Get custom forms linked to current node for a given fieldname.

Parameters

string $fieldName Name of the node-type field

Return Value

array

$this cleanNodesFromField(NodeTypeField $field, bool $flush = true)

Remove every node to node associations for a given field.

Parameters

NodeTypeField $field
bool $flush

Return Value

$this

$this addNodeForField(Node $node, NodeTypeField $field, bool $flush = true, null|integer $position = null)

Add a node to current node for a given node-type field.

Parameters

Node $node
NodeTypeField $field
bool $flush
null|integer $position

Return Value

$this

ArrayCollection getNodesFromFieldName(string $fieldName)

Get nodes linked to current node for a given fieldname.

Parameters

string $fieldName Name of the node-type field

Return Value

ArrayCollection Collection of nodes

ArrayCollection getReverseNodesFromFieldName(string $fieldName)

Get nodes reversed-linked to current node for a given fieldname.

Parameters

string $fieldName Name of the node-type field

Return Value

ArrayCollection Collection of nodes

NodesSources getNodeSourceByTranslation(Translation $translation)

Get node source by translation.

Parameters

Translation $translation

Return Value

NodesSources

$this removeAssociations()

Remove only current node associations.

Return Value

$this

$this removeWithChildrenAndAssociations()

Remove current node with its children recursively and its associations.

This method DOES NOT flush entityManager

Return Value

$this

$this softRemoveWithChildren()

Soft delete node and its children.

This method does not flush!

Return Value

$this

$this softUnremoveWithChildren()

Un-delete node and its children.

This method does not flush!

Return Value

$this

$this publishWithChildren()

Publish node and its children.

This method does not flush!

Return Value

$this

$this archiveWithChildren()

Archive node and its children.

This method does not flush!

Return Value

$this

Translation[] getAvailableTranslations()

Alias for NodeRepository::findAvailableTranslationForNode.

Return Value

Translation[]

array getAvailableTranslationsId()

Alias for NodeRepository::findAvailableTranslationIdForNode.

Return Value

array Array of Translation id

array getUnavailableTranslations()

Alias for NodeRepository::findUnavailableTranslationForNode.

Return Value

array

array findUnavailableTranslationIdForNode()

Alias for NodeRepository::findUnavailableTranslationIdForNode.

Return Value

array Array of Translation id

bool isRelatedToNewsletter()

Return if is in Newsletter Node.

Return Value

bool

bool isRelatedToNode(Node $relative)

Return if part of Node offspring.

Parameters

Node $relative

Return Value

bool

array getParents(TokenStorageInterface $tokenStorage = null)

Return every node’s parents

Parameters

TokenStorageInterface $tokenStorage

Return Value

array

int cleanPositions(bool $setPositions = true)

Clean position for current node siblings.

Warning, this method does not flush.

Parameters

bool $setPositions

Return Value

int Return the next position after the last node

int cleanChildrenPositions(bool $setPositions = true)

Reset current node children positions.

Warning, this method does not flush.

Parameters

bool $setPositions

Return Value

int Return the next position after the last node

static int cleanRootNodesPositions(bool $setPositions = true)

Reset every root nodes positions.

Warning, this method does not flush.

Parameters

bool $setPositions

Return Value

int Return the next position after the last node

array getAllOffspringId()

Return all node offspring id.

Return Value

array

$this makeHome()

Set current node as the Home node.

Return Value

$this

Node duplicate() deprecated

deprecated Use NodeDuplicator::duplicate() instead.

Duplicate current node with all its children.

Return Value

Node

Node getPrevious(array $criteria = null, array $order = null, AuthorizationChecker $authorizationChecker = null, boolean $preview = false)

Get previous node from hierarchy.

Parameters

array $criteria
array $order
AuthorizationChecker $authorizationChecker
boolean $preview

Return Value

Node

Node getNext(array $criteria = null, array $order = null, AuthorizationChecker $authorizationChecker = null, boolean $preview = false)

Get next node from hierarchy.

Parameters

array $criteria
array $order
AuthorizationChecker $authorizationChecker
boolean $preview

Return Value

Node