PHP Класс Jackalope\Node

You can iterate over the nodes children because it is an IteratorAggregate
Наследование: extends Item, implements IteratorAggregat\IteratorAggregate, implements PHPCR\NodeInterface
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$definition PHPCR\NodeType\NodeDefinitionInterface Cached instance of the node definition that defines this node
$deletedProperties this is needed in order to track deletions in case of refresh keys are the property names, values the properties (in state deleted)
$index integer TODO: fully implement same-name siblings
$nodes array ordered list of the child node names
$originalNodesOrder array used to calculate reordering operations if orderBefore() was used
$primaryType string The primary type name of this node
$properties Property[] all properties are instantiated in the constructor OPTIMIZE: lazy instantiate property objects, just have local array of values

Открытые методы

Метод Описание
__construct ( jackalope\FactoryInterface $factory, array $rawData, string $path, jackalope\Session $session, ObjectManager $objectManager, boolean $new = false ) Create a new node instance with data from the storage layer
addChildNode ( PHPCR\NodeInterface $node, boolean $check, string $name = null ) Adds child node to this node for internal reference
addMixin ( $mixinName ) {@inheritDoc}
addNode ( $relPath, $primaryNodeTypeName = null ) Creates a new node at the specified $relPath
addNodeAutoNamed ( $nameHint = null, $primaryNodeTypeName = null ) {@inheritDoc}
beginTransaction ( ) {@inheritDoc}
canAddMixin ( $mixinName ) {@inheritDoc}
commitTransaction ( ) {@inheritDoc}
confirmSaved ( ) In addition to calling parent method, tell all properties and clean deletedProperties
followLifecycleTransition ( $transition ) {@inheritDoc}
getAllowedLifecycleTransitions ( ) {@inheritDoc}
getCorrespondingNodePath ( $workspaceName ) {@inheritDoc}
getDefinition ( ) {@inheritDoc}
getIdentifier ( ) {@inheritDoc}
getIndex ( ) {@inheritDoc}
getIterator ( ) : Iterator Provide Traversable interface: redirect to getNodes with no filter
getMixinNodeTypes ( ) {@inheritDoc}
getNode ( $relPath ) {@inheritDoc}
getNodeNames ( $nameFilter = null, $typeFilter = null ) {@inheritDoc}
getNodes ( $nameFilter = null, $typeFilter = null ) {@inheritDoc}
getOrderCommands ( ) : array Returns the orderBefore commands to be applied to the childnodes to get from the original order to the new one
getPrimaryItem ( ) {@inheritDoc}
getPrimaryNodeType ( ) {@inheritDoc}
getProperties ( $nameFilter = null ) {@inheritDoc}
getPropertiesForStoreDeletedNode ( ) : Property[] This method is only meant for the transport to be able to still build a store request for afterwards deleted nodes to support the operationslog.
getPropertiesValues ( $nameFilter = null, $dereference = true ) {@inheritDoc}
getProperty ( $relPath ) {@inheritDoc}
getPropertyValue ( $name, $type = null ) {@inheritDoc}
getPropertyValueWithDefault ( $relPath, $defaultValue ) {@inheritDoc}
getReferences ( $name = null ) {@inheritDoc}
getSharedSet ( ) {@inheritDoc}
getWeakReferences ( $name = null ) {@inheritDoc}
hasNode ( $relPath ) {@inheritDoc}
hasNodes ( ) {@inheritDoc}
hasProperties ( ) {@inheritDoc}
hasProperty ( $relPath ) {@inheritDoc}
isCheckedOut ( ) {@inheritDoc}
isLocked ( ) {@inheritDoc}
isNodeType ( $nodeTypeName ) {@inheritDoc}
needsChildReordering ( ) : boolean Determine whether the children of this node need to be reordered
orderBefore ( $srcChildRelPath, $destChildRelPath ) Jackalope implements this feature and updates the position of the existing child at srcChildRelPath to be in the list immediately before destChildRelPath.
remove ( ) Remove this node
removeMixin ( $mixinName ) {@inheritDoc}
removeShare ( ) {@inheritDoc}
removeSharedSet ( ) {@inheritDoc}
rename ( $newName ) {@inheritDoc}
rollbackTransaction ( ) {@inheritDoc}
setChildrenDirty ( ) Mark all cached children as dirty.
setDeleted ( ) In addition to set this item deleted, set all properties to deleted.
setDirty ( $keepChanges = false, $targetState = false ) Overwrite to set the properties dirty as well.
setMixins ( array $mixinNames ) {@inheritDoc}
setPath ( $path, $move = false ) In addition to calling parent method, tell all properties
setPrimaryType ( $nodeTypeName ) Changes the primary node type of this node to nodeTypeName.
setProperty ( $name, $value, $type = PropertyType::UNDEFINED, boolean $validate = true ) {@inheritDoc}
unsetChildNode ( string $name, boolean $check ) Removes the reference in the internal node storage
unsetProperty ( string $name ) Removes the reference in the internal node storage
update ( $srcWorkspace ) {@inheritDoc}

Защищенные методы

Метод Описание
_setProperty ( string $name, mixed $value, string $type, boolean $internal ) : Property Implement really setting the property without any notification.
filterNames ( string | array $filter, array $names ) : array Filter the list of names according to the filter expression / array
generateUuid ( ) : string
getChildPath ( string $p ) : string Make sure $p is an absolute path
refresh ( $keepChanges, $internal = false ) Refresh this node

Приватные методы

Метод Описание
parseData ( array $rawData, boolean $update, boolean $keepChanges = false ) Initialize or update this object with raw data from backend.

Описание методов

__construct() публичный Метод

This is only to be called by the Factory::get() method even inside the Jackalope implementation to allow for custom implementations of Nodes.
См. также: TransportInterface::getNode()
public __construct ( jackalope\FactoryInterface $factory, array $rawData, string $path, jackalope\Session $session, ObjectManager $objectManager, boolean $new = false )
$factory jackalope\FactoryInterface the object factory
$rawData array in the format as returned from TransportInterface::getNode
$path string the absolute path of this node
$session jackalope\Session
$objectManager ObjectManager
$new boolean set to true if this is a new node being created. Defaults to false which means the node is loaded from storage.

_setProperty() защищенный Метод

Implement the setProperty, but also used from constructor or in refresh, when the backend has a new property that is not yet loaded in memory.
См. также: Node::setProperty
См. также: Node::refresh
См. также: Node::__construct
protected _setProperty ( string $name, mixed $value, string $type, boolean $internal ) : Property
$name string
$value mixed
$type string
$internal boolean whether we are setting this node through api or internally
Результат Property

addChildNode() публичный Метод

Adds child node to this node for internal reference
public addChildNode ( PHPCR\NodeInterface $node, boolean $check, string $name = null )
$node PHPCR\NodeInterface The name of the child node
$check boolean whether to check state
$name string is used in cases where $node->getName would not return the correct name (during move operation)

addMixin() публичный Метод

Jackalope validates type conflicts only on save, not immediately. It is possible to add mixin types after the first save.
public addMixin ( $mixinName )

addNode() публичный Метод

{@inheritDoc} In Jackalope, the child node type definition is immediately applied if no primaryNodeTypeName is specified. The PathNotFoundException and ConstraintViolationException are thrown immediately. Version and Lock related exceptions are delayed until save.
public addNode ( $relPath, $primaryNodeTypeName = null )

addNodeAutoNamed() публичный Метод

{@inheritDoc}
public addNodeAutoNamed ( $nameHint = null, $primaryNodeTypeName = null )

beginTransaction() публичный Метод

Additionally, notifies all properties of this node. Child nodes are not notified, it is the job of the ObjectManager to know which nodes are cached and notify them.
public beginTransaction ( )

canAddMixin() публичный Метод

{@inheritDoc}
public canAddMixin ( $mixinName )

commitTransaction() публичный Метод

Additionally, notifies all properties of this node. Child nodes are not notified, it is the job of the ObjectManager to know which nodes are cached and notify them.
public commitTransaction ( )

confirmSaved() публичный Метод

In addition to calling parent method, tell all properties and clean deletedProperties
public confirmSaved ( )

filterNames() защищенный статический Метод

Filter the list of names according to the filter expression / array
protected static filterNames ( string | array $filter, array $names ) : array
$filter string | array according to getNodes|getProperties
$names array list of names to filter
Результат array the names in $names that match the filter

followLifecycleTransition() публичный Метод

{@inheritDoc}
public followLifecycleTransition ( $transition )

generateUuid() защищенный Метод

protected generateUuid ( ) : string
Результат string a universally unique id.

getAllowedLifecycleTransitions() публичный Метод

{@inheritDoc}

getChildPath() защищенный Метод

If its a relative path, prepend the path to this node, otherwise return as is
protected getChildPath ( string $p ) : string
$p string the relative or absolute property or node path
Результат string the absolute path to this item, with relative paths resolved against the current node

getCorrespondingNodePath() публичный Метод

{@inheritDoc}
public getCorrespondingNodePath ( $workspaceName )

getDefinition() публичный Метод

{@inheritDoc}
public getDefinition ( )

getIdentifier() публичный Метод

{@inheritDoc}
public getIdentifier ( )

getIndex() публичный Метод

{@inheritDoc}
public getIndex ( )

getIterator() публичный Метод

Provide Traversable interface: redirect to getNodes with no filter
public getIterator ( ) : Iterator
Результат Iterator over all child nodes

getMixinNodeTypes() публичный Метод

{@inheritDoc}
public getMixinNodeTypes ( )

getNode() публичный Метод

{@inheritDoc}
public getNode ( $relPath )

getNodeNames() публичный Метод

{@inheritDoc}
public getNodeNames ( $nameFilter = null, $typeFilter = null )

getNodes() публичный Метод

{@inheritDoc}
public getNodes ( $nameFilter = null, $typeFilter = null )

getOrderCommands() публичный Метод

Returns the orderBefore commands to be applied to the childnodes to get from the original order to the new one
public getOrderCommands ( ) : array
Результат array of arrays with 2 fields: name of node to order before second name

getPrimaryItem() публичный Метод

{@inheritDoc}
public getPrimaryItem ( )

getPrimaryNodeType() публичный Метод

{@inheritDoc}
public getPrimaryNodeType ( )

getProperties() публичный Метод

{@inheritDoc}
public getProperties ( $nameFilter = null )

getPropertiesForStoreDeletedNode() публичный Метод

This method is only meant for the transport to be able to still build a store request for afterwards deleted nodes to support the operationslog.
См. также: Jackalope\Transport\WritingInterface::storeNodes
public getPropertiesForStoreDeletedNode ( ) : Property[]
Результат Property[] with just the jcr:primaryType property in it

getPropertiesValues() публичный Метод

{@inheritDoc}
public getPropertiesValues ( $nameFilter = null, $dereference = true )

getProperty() публичный Метод

{@inheritDoc}
public getProperty ( $relPath )

getPropertyValue() публичный Метод

{@inheritDoc}
public getPropertyValue ( $name, $type = null )

getPropertyValueWithDefault() публичный Метод

{@inheritDoc}
public getPropertyValueWithDefault ( $relPath, $defaultValue )

getReferences() публичный Метод

{@inheritDoc}
public getReferences ( $name = null )

getSharedSet() публичный Метод

{@inheritDoc}
public getSharedSet ( )

getWeakReferences() публичный Метод

{@inheritDoc}
public getWeakReferences ( $name = null )

hasNode() публичный Метод

{@inheritDoc}
public hasNode ( $relPath )

hasNodes() публичный Метод

{@inheritDoc}
public hasNodes ( )

hasProperties() публичный Метод

{@inheritDoc}
public hasProperties ( )

hasProperty() публичный Метод

{@inheritDoc}
public hasProperty ( $relPath )

isCheckedOut() публичный Метод

{@inheritDoc}
public isCheckedOut ( )

isLocked() публичный Метод

{@inheritDoc}
public isLocked ( )

isNodeType() публичный Метод

{@inheritDoc}
public isNodeType ( $nodeTypeName )

needsChildReordering() публичный Метод

Determine whether the children of this node need to be reordered
public needsChildReordering ( ) : boolean
Результат boolean

orderBefore() публичный Метод

{@inheritDoc} Jackalope has no implementation-specific ordering restriction so no \PHPCR\ConstraintViolationException is expected. VersionException and LockException are not tested immediately but thrown on save.
public orderBefore ( $srcChildRelPath, $destChildRelPath )

refresh() защищенный Метод

{@inheritDoc} This is also called internally to refresh when the node is accessed in state DIRTY.
См. также: Item::checkState
protected refresh ( $keepChanges, $internal = false )

remove() публичный Метод

{@inheritDoc} A jackalope node needs to notify the parent node about this if it is cached, in addition to \PHPCR\ItemInterface::remove()
public remove ( )

removeMixin() публичный Метод

{@inheritDoc}
public removeMixin ( $mixinName )

removeShare() публичный Метод

{@inheritDoc}
public removeShare ( )

removeSharedSet() публичный Метод

{@inheritDoc}
public removeSharedSet ( )

rename() публичный Метод

{@inheritDoc}
public rename ( $newName )

rollbackTransaction() публичный Метод

Additionally, notifies all properties of this node. Child nodes are not notified, it is the job of the ObjectManager to know which nodes are cached and notify them.
public rollbackTransaction ( )

setChildrenDirty() публичный Метод

Mark all cached children as dirty.
public setChildrenDirty ( )

setDeleted() публичный Метод

They will be automatically deleted by the backend, but the user might still have a reference to one of the property objects.
public setDeleted ( )

setDirty() публичный Метод

Overwrite to set the properties dirty as well.
public setDirty ( $keepChanges = false, $targetState = false )

setMixins() публичный Метод

{@inheritDoc}
public setMixins ( array $mixinNames )
$mixinNames array

setPath() публичный Метод

In addition to calling parent method, tell all properties
public setPath ( $path, $move = false )

setPrimaryType() публичный Метод

{@inheritDoc} Jackalope only validates type conflicts on save.
public setPrimaryType ( $nodeTypeName )

setProperty() публичный Метод

{@inheritDoc}
public setProperty ( $name, $value, $type = PropertyType::UNDEFINED, boolean $validate = true )
$validate boolean does the NodeType control throw an exception if the property can't be set? To use in case of UUID import

unsetChildNode() публичный Метод

Removes the reference in the internal node storage
public unsetChildNode ( string $name, boolean $check )
$name string the name of the child node to unset
$check boolean whether a state check should be done - set to false during internal update operations

unsetProperty() публичный Метод

Removes the reference in the internal node storage
public unsetProperty ( string $name )
$name string the name of the property to unset.

update() публичный Метод

{@inheritDoc}
public update ( $srcWorkspace )

Описание свойств

$definition защищенное свойство

Cached instance of the node definition that defines this node
См. также: Node::getDefinition()
protected NodeDefinitionInterface,PHPCR\NodeType $definition
Результат PHPCR\NodeType\NodeDefinitionInterface

$deletedProperties защищенное свойство

this is needed in order to track deletions in case of refresh keys are the property names, values the properties (in state deleted)
protected $deletedProperties

$index защищенное свойство

TODO: fully implement same-name siblings
protected int $index
Результат integer

$nodes защищенное свойство

ordered list of the child node names
protected array $nodes
Результат array

$originalNodesOrder защищенное свойство

used to calculate reordering operations if orderBefore() was used
protected array $originalNodesOrder
Результат array

$primaryType защищенное свойство

The primary type name of this node
protected string $primaryType
Результат string

$properties защищенное свойство

all properties are instantiated in the constructor OPTIMIZE: lazy instantiate property objects, just have local array of values
protected Property[],jackalope $properties
Результат Property[]