NodeRepository
extends NestedTreeRepository
in package
NodeRepository
Tags
Table of Contents
Constants
- DataProperty = '__data'
Properties
- $em : mixed
Methods
- __construct() : mixed
- find() : mixed
- findBy() : array<string|int, mixed>
- Finds entities by a set of criteria.
- findOneBy() : mixed
- {@inheritdoc}
- getNextSiblings() : array<string|int, mixed>
- Find the next siblings of the given $node
- getNextSiblingsQuery() : Query
- Get the query for next siblings of the given $node
- getPrevSiblings() : array<string|int, mixed>
- Find the previous siblings of the given $node
- getPrevSiblingsQuery() : Query
- Get query for previous siblings of the given $node
- getRoot() : Node
- Returns the root node.
- moveDown() : bool
- Move the node down in the same level
- moveUp() : bool
- Move the node up in the same level
- recover() : void
- Tries to recover the tree
- translateRecursive() : array<string|int, mixed>
- Translates a branch of the tree recursively
- recoverBranch() : mixed
- Tries to recover a branch - assuming that level and left of $rootNode are correct!
Constants
DataProperty
public
mixed
DataProperty
= '__data'
Properties
$em
protected
mixed
$em
= null
Methods
__construct()
public
__construct(EntityManager $em, ClassMetadata $class) : mixed
Parameters
- $em : EntityManager
- $class : ClassMetadata
find()
public
find(mixed $id[, mixed $lockMode = 0 ][, mixed $lockVersion = NULL ]) : mixed
Parameters
- $id : mixed
- $lockMode : mixed = 0
- $lockVersion : mixed = NULL
findBy()
Finds entities by a set of criteria.
public
findBy(array<string|int, mixed> $criteria[, array<string|int, mixed> $orderBy = null ][, mixed $limit = null ][, mixed $offset = null ]) : array<string|int, mixed>
Parameters
- $criteria : array<string|int, mixed>
- $orderBy : array<string|int, mixed> = null
- $limit : mixed = null
- $offset : mixed = null
Tags
Return values
array<string|int, mixed>findOneBy()
{@inheritdoc}
public
findOneBy(array<string|int, mixed> $criteria[, array<string|int, mixed> $orderBy = null ]) : mixed
Parameters
- $criteria : array<string|int, mixed>
- $orderBy : array<string|int, mixed> = null
getNextSiblings()
Find the next siblings of the given $node
public
getNextSiblings(object $node[, bool $includeSelf = false ][, mixed $skipAliasNodes = false ]) : array<string|int, mixed>
Parameters
- $node : object
- $includeSelf : bool = false
-
- include the node itself
- $skipAliasNodes : mixed = false
Return values
array<string|int, mixed>getNextSiblingsQuery()
Get the query for next siblings of the given $node
public
getNextSiblingsQuery(object $node[, bool $includeSelf = false ][, mixed $skipAliasNodes = false ]) : Query
Parameters
- $node : object
- $includeSelf : bool = false
-
- include the node itself
- $skipAliasNodes : mixed = false
Tags
Return values
QuerygetPrevSiblings()
Find the previous siblings of the given $node
public
getPrevSiblings(object $node[, bool $includeSelf = false ][, mixed $skipAliasNodes = false ]) : array<string|int, mixed>
Parameters
- $node : object
- $includeSelf : bool = false
-
- include the node itself
- $skipAliasNodes : mixed = false
Return values
array<string|int, mixed>getPrevSiblingsQuery()
Get query for previous siblings of the given $node
public
getPrevSiblingsQuery(object $node[, bool $includeSelf = false ][, mixed $skipAliasNodes = false ]) : Query
Parameters
- $node : object
- $includeSelf : bool = false
-
- include the node itself
- $skipAliasNodes : mixed = false
Tags
Return values
QuerygetRoot()
Returns the root node.
public
getRoot() : Node
Tags
Return values
NodemoveDown()
Move the node down in the same level
public
moveDown(object $node[, mixed $number = 1 ][, mixed $skipAliasNodes = false ]) : bool
Parameters
- $node : object
- $number : mixed = 1
-
integer - number of positions to shift boolean - if "true" - shift till last position
- $skipAliasNodes : mixed = false
Tags
Return values
bool —- true if shifted
moveUp()
Move the node up in the same level
public
moveUp(object $node[, mixed $number = 1 ][, mixed $skipAliasNodes = false ]) : bool
Parameters
- $node : object
- $number : mixed = 1
-
integer - number of positions to shift boolean - true shift till first position
- $skipAliasNodes : mixed = false
Tags
Return values
bool —- true if shifted
recover()
Tries to recover the tree
public
recover() : void
Tags
translateRecursive()
Translates a branch of the tree recursively
public
translateRecursive(Node $rootNode, int $fromLanguage, int $toLanguage, bool $includingContent[, int $limit = 0 ][, int $offset = 0 ]) : array<string|int, mixed>
Parameters
- $rootNode : Node
-
Node to start with (see todo, optional for now)
- $fromLanguage : int
-
Language id to copy from
- $toLanguage : int
-
Language id to copy to
- $includingContent : bool
-
Wheter to copy content or set type to fallback
- $limit : int = 0
-
(optional) How many nodes should be copied, 0 means all, defaults to 0
- $offset : int = 0
-
(optional) How many nodes should be skipped, defaults to 0
Tags
Return values
array<string|int, mixed> —Returns an array with the following structure: array('count'=>{count of nodes}, 'offset'=>{current offset after copy})
recoverBranch()
Tries to recover a branch - assuming that level and left of $rootNode are correct!
private
recoverBranch(Node $rootNode[, mixed &$left = null ][, mixed $level = null ]) : mixed
Parameters
- $rootNode : Node
-
Node to start with
- $left : mixed = null
- $level : mixed = null