PHP Class Jackalope\Node

You can iterate over the nodes children because it is an IteratorAggregate
Inheritance: extends Item, implements IteratorAggregat\IteratorAggregate, implements PHPCR\NodeInterface
Afficher le fichier Open project: jackalope/jackalope Class Usage Examples

Protected Properties

Свойство Type Description
$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

Méthodes publiques

Méthode Description
__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}

Méthodes protégées

Méthode Description
_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

Private Methods

Méthode Description
parseData ( array $rawData, boolean $update, boolean $keepChanges = false ) Initialize or update this object with raw data from backend.

Method Details

__construct() public méthode

This is only to be called by the Factory::get() method even inside the Jackalope implementation to allow for custom implementations of Nodes.
See also: 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() protected méthode

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.
See also: Node::setProperty
See also: Node::refresh
See also: 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
Résultat Property

addChildNode() public méthode

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() public méthode

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

addNode() public méthode

{@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() public méthode

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

beginTransaction() public méthode

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() public méthode

{@inheritDoc}
public canAddMixin ( $mixinName )

commitTransaction() public méthode

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() public méthode

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

filterNames() protected static méthode

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
Résultat array the names in $names that match the filter

followLifecycleTransition() public méthode

{@inheritDoc}
public followLifecycleTransition ( $transition )

generateUuid() protected méthode

protected generateUuid ( ) : string
Résultat string a universally unique id.

getAllowedLifecycleTransitions() public méthode

{@inheritDoc}

getChildPath() protected méthode

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
Résultat string the absolute path to this item, with relative paths resolved against the current node

getCorrespondingNodePath() public méthode

{@inheritDoc}
public getCorrespondingNodePath ( $workspaceName )

getDefinition() public méthode

{@inheritDoc}
public getDefinition ( )

getIdentifier() public méthode

{@inheritDoc}
public getIdentifier ( )

getIndex() public méthode

{@inheritDoc}
public getIndex ( )

getIterator() public méthode

Provide Traversable interface: redirect to getNodes with no filter
public getIterator ( ) : Iterator
Résultat Iterator over all child nodes

getMixinNodeTypes() public méthode

{@inheritDoc}
public getMixinNodeTypes ( )

getNode() public méthode

{@inheritDoc}
public getNode ( $relPath )

getNodeNames() public méthode

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

getNodes() public méthode

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

getOrderCommands() public méthode

Returns the orderBefore commands to be applied to the childnodes to get from the original order to the new one
public getOrderCommands ( ) : array
Résultat array of arrays with 2 fields: name of node to order before second name

getPrimaryItem() public méthode

{@inheritDoc}
public getPrimaryItem ( )

getPrimaryNodeType() public méthode

{@inheritDoc}
public getPrimaryNodeType ( )

getProperties() public méthode

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

getPropertiesForStoreDeletedNode() public méthode

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.
See also: Jackalope\Transport\WritingInterface::storeNodes
public getPropertiesForStoreDeletedNode ( ) : Property[]
Résultat Property[] with just the jcr:primaryType property in it

getPropertiesValues() public méthode

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

getProperty() public méthode

{@inheritDoc}
public getProperty ( $relPath )

getPropertyValue() public méthode

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

getPropertyValueWithDefault() public méthode

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

getReferences() public méthode

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

getSharedSet() public méthode

{@inheritDoc}
public getSharedSet ( )

getWeakReferences() public méthode

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

hasNode() public méthode

{@inheritDoc}
public hasNode ( $relPath )

hasNodes() public méthode

{@inheritDoc}
public hasNodes ( )

hasProperties() public méthode

{@inheritDoc}
public hasProperties ( )

hasProperty() public méthode

{@inheritDoc}
public hasProperty ( $relPath )

isCheckedOut() public méthode

{@inheritDoc}
public isCheckedOut ( )

isLocked() public méthode

{@inheritDoc}
public isLocked ( )

isNodeType() public méthode

{@inheritDoc}
public isNodeType ( $nodeTypeName )

needsChildReordering() public méthode

Determine whether the children of this node need to be reordered
public needsChildReordering ( ) : boolean
Résultat boolean

orderBefore() public méthode

{@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() protected méthode

{@inheritDoc} This is also called internally to refresh when the node is accessed in state DIRTY.
See also: Item::checkState
protected refresh ( $keepChanges, $internal = false )

remove() public méthode

{@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() public méthode

{@inheritDoc}
public removeMixin ( $mixinName )

removeShare() public méthode

{@inheritDoc}
public removeShare ( )

removeSharedSet() public méthode

{@inheritDoc}
public removeSharedSet ( )

rename() public méthode

{@inheritDoc}
public rename ( $newName )

rollbackTransaction() public méthode

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() public méthode

Mark all cached children as dirty.
public setChildrenDirty ( )

setDeleted() public méthode

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() public méthode

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

setMixins() public méthode

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

setPath() public méthode

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

setPrimaryType() public méthode

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

setProperty() public méthode

{@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() public méthode

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() public méthode

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

update() public méthode

{@inheritDoc}
public update ( $srcWorkspace )

Property Details

$definition protected_oe property

Cached instance of the node definition that defines this node
See also: Node::getDefinition()
protected NodeDefinitionInterface,PHPCR\NodeType $definition
Résultat PHPCR\NodeType\NodeDefinitionInterface

$deletedProperties protected_oe property

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 protected_oe property

TODO: fully implement same-name siblings
protected int $index
Résultat integer

$nodes protected_oe property

ordered list of the child node names
protected array $nodes
Résultat array

$originalNodesOrder protected_oe property

used to calculate reordering operations if orderBefore() was used
protected array $originalNodesOrder
Résultat array

$primaryType protected_oe property

The primary type name of this node
protected string $primaryType
Résultat string

$properties protected_oe property

all properties are instantiated in the constructor OPTIMIZE: lazy instantiate property objects, just have local array of values
protected Property[],jackalope $properties
Résultat Property[]