PHP Class Jackalope\ObjectManager

For write operations, the object manager acts as the Unit of Work handler: it keeps track which nodes are dirty and updates them with the transport interface.
Afficher le fichier Open project: jackalope/jackalope Class Usage Examples

Protected Properties

Свойство Type Description
$factory jackalope\FactoryInterface The factory to instantiate objects
$nodesAdd Jackalope\Transport\AddNodeOperation[] Keys are the full paths to be added
$nodesMove Jackalope\Transport\MoveNodeOperation[] Keys are the source paths, values the move operations containing the target path. The objectsByPath array is updated immediately and any getItem and similar requests are rewritten for the transport layer until save() Only nodes can be moved, not properties. Note: Keep in mind that moving also affects all children of the moved node, but we only have the explicitly moved paths in this array. We check on moved parents whenever retrieving a non-cached node.
$nodesRemove Jackalope\Transport\RemoveNodeOperation[] Keys are the full paths to be removed. Note: Keep in mind that a delete is recursive, but we only have the explicitly deleted paths in this array. We check on deleted parents whenever retrieving a non-cached node.
$objectsByPath array There is no notion of order here. The order is defined by order in the Node::nodes array.
$objectsByUuid array Take care never to put a path in here unless there is a node for that path in objectsByPath.
$operationsLog Jackalope\Transport\Operation[] Add, remove and move actions need to be saved in the correct order to avoid i.e. adding something where a node has not yet been moved to.
$propertiesRemove Jackalope\Transport\RemovePropertyOperation[] Keys are the full paths of properties to be removed.
$session PHPCR\SessionInterface
$transport Jackalope\Transport\TransportInterface

Méthodes publiques

Méthode Description
__construct ( jackalope\FactoryInterface $factory, Jackalope\Transport\TransportInterface $transport, PHPCR\SessionInterface $session ) Create the ObjectManager instance with associated session and transport
addNode ( string $absPath, PHPCR\NodeInterface $node ) WRITE: add a node at the specified path. Schedules an add operation for the next save() and caches the node.
addVersionLabel ( $path, $label, $moveLabel )
beginTransaction ( ) Begin new transaction associated with current session.
checkin ( string $absPath ) : PHPCR\Version\VersionInterface Removes the cache of the predecessor version after the node has been checked in.
checkout ( $absPath ) Removes the cache of the predecessor version after the node has been checked in.
clear ( ) Clears the state of the current session
cloneFromImmediately ( string $srcWorkspace, string $srcAbsPath, string $destAbsPath, boolean $removeExisting ) Implement the workspace clone method. It is dispatched immediately.
commitTransaction ( ) Complete the transaction associated with the current session.
copyNodeImmediately ( string $srcAbsPath, string $destAbsPath, string $srcWorkspace ) Implement the workspace copy method. It is dispatched immediately.
filterChildNodeNamesByType ( PHPCR\NodeInterface $node, string | array $nameFilter, string | array $typeFilter ) : ArrayIterato\ArrayIterator This method will either let the transport filter if that is possible or forward to getNodes and return the names of the nodes found there.,
getBinaryStream ( string $path ) : resource Retrieves the stream for a binary value.
getCachedDescendants ( string $absPath, string $class = 'Node' ) : ArrayIterato\ArrayIterator Return an ArrayIterator containing all the cached children of the given node.
getCachedNode ( string $absPath, $class = 'Node' ) : PHPCR\NodeInterface Get a node if it is already in cache or null otherwise.
getCachedNodeByUuid ( $uuid, string $class = 'Node' ) : PHPCR\NodeInterface Get a node if it is already in cache or null otherwise.
getNode ( string $relPath, string $context, string $class = 'Node' ) : PHPCR\NodeInterface Get the node identified by a relative path.
getNodeByIdentifier ( string $identifier, string $class = 'Node' ) : PHPCR\NodeInterface Get the node identified by an uuid.
getNodeByPath ( string $absPath, string $class = 'Node', object $object = null ) : PHPCR\NodeInterface Get the node identified by an absolute path.
getNodeType ( string $nodeType ) : DOMDocument Get a single nodetype.
getNodeTypes ( array $nodeTypes = [] ) : array | DOMDocument Returns the node types specified by name in the array or all types if no filter is given.
getNodesByIdentifier ( array $identifiers, string $class = 'Node' ) : ArrayIterato\ArrayIterator | Node[] Get the nodes identified by the given UUIDs.
getNodesByPath ( array $absPaths, string $class = 'Node', array | null $typeFilter = null ) : Node[] Get multiple nodes identified by an absolute paths. Missing nodes are ignored.
getNodesByPathAsArray ( $paths, $class = 'Node', $typeFilter = null )
getPermissions ( string $absPath ) : array Return the permissions of the current session on the node given by path.
getPropertiesByPath ( $absPaths ) : ArrayIterato\ArrayIterator Get all nodes of those properties in one batch, then collect the properties of them.
getPropertyByPath ( string $absPath ) : PHPCR\PropertyInterface Get the property identified by an absolute path.
getReferences ( string $path, string $name = null ) : ArrayIterato\ArrayIterator Returns all accessible REFERENCE properties in the workspace that point to the node
getTransport ( ) : Jackalope\Transport\TransportInterface Implementation specific: Transport is used elsewhere, provide it here for Session
getWeakReferences ( string $path, string $name = null ) : ArrayIterato\ArrayIterator Returns all accessible WEAKREFERENCE properties in the workspace that point to the node
hasPendingChanges ( ) : boolean Determine if any object is modified and not saved to storage.
isNodeDeleted ( string $absPath ) : boolean Check whether the node at path has an unpersisted delete operation and there is no other node moved or added there.
isNodeMoved ( string $absPath ) : boolean Check whether a node path has an unpersisted move operation.
moveNode ( string $srcAbsPath, string $destAbsPath ) WRITE: move node from source path to destination path
moveNodeImmediately ( string $srcAbsPath, string $destAbsPath ) Implement the workspace move method. It is dispatched to transport immediately.
purgeDisappearedNode ( string $absPath, boolean $keepChanges ) : boolean Purge an item given by path from the cache and return whether the node should forget it or keep it.
refresh ( boolean $keepChanges ) Refresh cached items from the backend.
registerNodeTypes ( array $types, boolean $allowUpdate ) : boolean Register node types with the backend.
registerNodeTypesCnd ( string $cnd, boolean $allowUpdate ) : boolean | Iterator Register node types with compact node definition format
removeItem ( string $absPath, PHPCR\PropertyInterface $property = null ) Remove a node or a property.
removeItemImmediately ( string $absPath ) Implement the workspace removeItem method.
removeVersion ( string $versionPath, string $versionName ) Remove a version given the path to the version node and the version name.
removeVersionLabel ( $path, $label )
restore ( boolean $removeExisting, string $versionPath, string $nodePath ) Restore the node at $nodePath to the version at $versionPath
rollbackTransaction ( ) Roll back the transaction associated with the current session.
save ( ) Push all recorded changes to the backend.

Méthodes protégées

Méthode Description
cascadeDelete ( string $absPath, boolean $sessionOperation = true ) Notify all cached children that they are deleted as well and clean up internal state
cascadeDeleteVersion ( string $absPath ) Notify all cached version children that they are deleted as well and clean up internal state
executeBatch ( integer $type, Jackalope\Transport\Operation[] $operations ) Execute a batch of operations of one type.
executeOperations ( array $operations ) Execute the recorded operations in the right order, skipping stale data.
getFetchPath ( string $absPath, string $class ) : string Resolve the path through all pending operations and sanity check while doing this.
getNodePath ( string $absPath ) : array Get the node path for a property, and the property name
notifyItems ( string $method ) Notifies the given node and all of its children and properties that a transaction has begun, was committed or rolled back so that the item has a chance to save or restore his internal state.
pathArrayToPropertiesIterator ( array $propertyPaths ) : ArrayIterato\ArrayIterator Transform an array containing properties paths to an ArrayIterator over Property objects
performNodeRemove ( string $absPath, PHPCR\NodeInterface $node, boolean $sessionOperation = true, $cascading = false ) Remove the item at absPath from local cache and keep information for undo.
performPropertyRemove ( string $absPath, PHPCR\PropertyInterface $property, boolean $sessionOperation = true ) Remove the item at absPath from local cache and keep information for undo.
rewriteItemPaths ( string $curPath, string $newPath ) Rewrites the path of a node for the movement operation, also updating all cached children.

Private Methods

Méthode Description
getMoveSrcPath ( string $dstPath ) : string | boolean Get the src path of a move operation knowing the target path.
matchNodeType ( PHPCR\NodeInterface $node, array $typeFilter ) : boolean Check if a node is of any of the types listed in typeFilter.

Method Details

__construct() public méthode

Create the ObjectManager instance with associated session and transport
public __construct ( jackalope\FactoryInterface $factory, Jackalope\Transport\TransportInterface $transport, PHPCR\SessionInterface $session )
$factory jackalope\FactoryInterface the object factory
$transport Jackalope\Transport\TransportInterface
$session PHPCR\SessionInterface

addNode() public méthode

WRITE: add a node at the specified path. Schedules an add operation for the next save() and caches the node.
public addNode ( string $absPath, PHPCR\NodeInterface $node )
$absPath string the path to the node or property, including the item name
$node PHPCR\NodeInterface The item instance that is added.

addVersionLabel() public méthode

See also: VersioningInterface::addVersionLabel
public addVersionLabel ( $path, $label, $moveLabel )

beginTransaction() public méthode

Begin new transaction associated with current session.
public beginTransaction ( )

cascadeDelete() protected méthode

Notify all cached children that they are deleted as well and clean up internal state
protected cascadeDelete ( string $absPath, boolean $sessionOperation = true )
$absPath string parent node that was removed
$sessionOperation boolean to carry over the session operation information

cascadeDeleteVersion() protected méthode

Notify all cached version children that they are deleted as well and clean up internal state
protected cascadeDeleteVersion ( string $absPath )
$absPath string parent version node that was removed

checkin() public méthode

TODO: document more clearly
See also: VersionManager::checkin
public checkin ( string $absPath ) : PHPCR\Version\VersionInterface
$absPath string
Résultat PHPCR\Version\VersionInterface node version

checkout() public méthode

TODO: document more clearly. This looks like copy-paste from checkin
See also: VersionManager::checkout
public checkout ( $absPath )

clear() public méthode

Removes all cached objects, planned changes etc. Mostly useful for testing purposes.
Deprecation: : this will screw up major, as the user of the api can still have references to nodes. USE refresh instead!
public clear ( )

cloneFromImmediately() public méthode

http://www.day.com/specs/jcr/2.0/3_Repository_Model.html#3.10%20Corresponding%20Nodes http://www.day.com/specs/jcr/2.0/10_Writing.html#10.8%20Cloning%20and%20Updating%20Nodes
See also: Workspace::cloneFrom()
public cloneFromImmediately ( string $srcWorkspace, string $srcAbsPath, string $destAbsPath, boolean $removeExisting )
$srcWorkspace string the name of the workspace from which the copy is to be made.
$srcAbsPath string the path of the node to be cloned.
$destAbsPath string the location to which the node at srcAbsPath is to be cloned in this workspace.
$removeExisting boolean

commitTransaction() public méthode

TODO: Make sure RollbackException and AccessDeniedException are thrown by the transport if corresponding problems occur.
public commitTransaction ( )

copyNodeImmediately() public méthode

Implement the workspace copy method. It is dispatched immediately.
See also: Workspace::copy()
public copyNodeImmediately ( string $srcAbsPath, string $destAbsPath, string $srcWorkspace )
$srcAbsPath string the path of the node to be copied.
$destAbsPath string the location to which the node at srcAbsPath is to be copied in this workspace.
$srcWorkspace string the name of the workspace from which the copy is to be made.

executeBatch() protected méthode

Execute a batch of operations of one type.
protected executeBatch ( integer $type, Jackalope\Transport\Operation[] $operations )
$type integer type of the operations to be executed
$operations Jackalope\Transport\Operation[] list of same type operations

executeOperations() protected méthode

Execute the recorded operations in the right order, skipping stale data.
protected executeOperations ( array $operations )
$operations array

filterChildNodeNamesByType() public méthode

This method will either let the transport filter if that is possible or forward to getNodes and return the names of the nodes found there.,
public filterChildNodeNamesByType ( PHPCR\NodeInterface $node, string | array $nameFilter, string | array $typeFilter ) : ArrayIterato\ArrayIterator
$node PHPCR\NodeInterface
$nameFilter string | array
$typeFilter string | array
Résultat ArrayIterato\ArrayIterator

getBinaryStream() public méthode

Retrieves the stream for a binary value.
public getBinaryStream ( string $path ) : resource
$path string The absolute path to the stream
Résultat resource

getCachedDescendants() public méthode

It makes no difference whether or not the node itself is cached. Note that this method will also return deleted node objects so you can use them in refresh operations.
public getCachedDescendants ( string $absPath, string $class = 'Node' ) : ArrayIterato\ArrayIterator
$absPath string
$class string
Résultat ArrayIterato\ArrayIterator

getCachedNode() public méthode

Note that this method will also return deleted node objects so you can use them in refresh operations.
See also: Node::refresh()
public getCachedNode ( string $absPath, $class = 'Node' ) : PHPCR\NodeInterface
$absPath string the absolute path to the node to fetch from cache
Résultat PHPCR\NodeInterface or null

getCachedNodeByUuid() public méthode

As getCachedNode but looking up the node by uuid. Note that this will never return you a removed node because the uuid is removed from the map.
See also: getCachedNode
public getCachedNodeByUuid ( $uuid, string $class = 'Node' ) : PHPCR\NodeInterface
$uuid
$class string
Résultat PHPCR\NodeInterface or null

getFetchPath() protected méthode

Resolve the path through all pending operations and sanity check while doing this.
protected getFetchPath ( string $absPath, string $class ) : string
$absPath string The absolute path of the node to fetch.
$class string The class of node to get. TODO: Is it sane to fetch data separately for Version and normal Node?
Résultat string fetch path

getNode() public méthode

If you have an absolute path use {@link getNodeByPath()} for better performance.
See also: Session::getNode()
public getNode ( string $relPath, string $context, string $class = 'Node' ) : PHPCR\NodeInterface
$relPath string relative path
$context string context path
$class string optional class name for the factory
Résultat PHPCR\NodeInterface The specified Node. if not available, ItemNotFoundException is thrown

getNodeByIdentifier() public méthode

Get the node identified by an uuid.
See also: Session::getNodeByIdentifier()
public getNodeByIdentifier ( string $identifier, string $class = 'Node' ) : PHPCR\NodeInterface
$identifier string uuid
$class string optional class name for factory
Résultat PHPCR\NodeInterface The specified Node. if not available, ItemNotFoundException is thrown

getNodeByPath() public méthode

To prevent unnecessary work to be done a cache is filled to only fetch nodes once. To reset a node with the data from the backend, use Node::refresh() Uses the factory to create a Node object.
See also: Session::getNode()
public getNodeByPath ( string $absPath, string $class = 'Node', object $object = null ) : PHPCR\NodeInterface
$absPath string The absolute path of the node to fetch.
$class string The class of node to get. TODO: Is it sane to fetch data separately for Version and normal Node?
$object object A (prefetched) object (de-serialized json) from the backend only to be used if we get child nodes in one backend call
Résultat PHPCR\NodeInterface

getNodePath() protected méthode

Get the node path for a property, and the property name
protected getNodePath ( string $absPath ) : array
$absPath string
Résultat array with name, node path

getNodeType() public méthode

Get a single nodetype.
See also: getNodeTypes()
public getNodeType ( string $nodeType ) : DOMDocument
$nodeType string the name of nodetype to get from the transport
Résultat DOMDocument containing the nodetype information

getNodeTypes() public méthode

This is only a proxy to the transport
public getNodeTypes ( array $nodeTypes = [] ) : array | DOMDocument
$nodeTypes array Empty for all or specify node types by name
Résultat array | DOMDocument containing the nodetype information

getNodesByIdentifier() public méthode

Note UUIDs that are not found will be ignored. Also, duplicate IDs will be eliminated by nature of using the IDs as keys.
See also: Session::getNodesByIdentifier()
public getNodesByIdentifier ( array $identifiers, string $class = 'Node' ) : ArrayIterato\ArrayIterator | Node[]
$identifiers array UUIDs of nodes to retrieve.
$class string Optional class name for the factory.
Résultat ArrayIterato\ArrayIterator | Node[] Iterator of the specified nodes keyed by their unique ids

getNodesByPath() public méthode

Note paths that cannot be found will be ignored and missing from the result. Uses the factory to create Node objects.
See also: Session::getNodes()
public getNodesByPath ( array $absPaths, string $class = 'Node', array | null $typeFilter = null ) : Node[]
$absPaths array Array containing the absolute paths of the nodes to fetch.
$class string The class of node to get. TODO: Is it sane to fetch data separately for Version and normal Node?
$typeFilter array | null Node type list to skip some nodes
Résultat Node[] Iterator that contains all found NodeInterface instances keyed by their path

getNodesByPathAsArray() public méthode

public getNodesByPathAsArray ( $paths, $class = 'Node', $typeFilter = null )

getPermissions() public méthode

Permission can be of 4 types: - add_node - read - remove - set_property This function will return an array containing zero, one or more of the above strings.
public getPermissions ( string $absPath ) : array
$absPath string absolute path to node to get permissions for it
Résultat array of string

getPropertiesByPath() public méthode

Get all nodes of those properties in one batch, then collect the properties of them.
public getPropertiesByPath ( $absPaths ) : ArrayIterato\ArrayIterator
$absPaths
Résultat ArrayIterato\ArrayIterator that contains all found PropertyInterface instances keyed by their path

getPropertyByPath() public méthode

Uses the factory to instantiate a Property. Currently Jackalope just loads the containing node and then returns the requested property of the node instance.
public getPropertyByPath ( string $absPath ) : PHPCR\PropertyInterface
$absPath string The absolute path of the property to create.
Résultat PHPCR\PropertyInterface

getReferences() public méthode

Returns all accessible REFERENCE properties in the workspace that point to the node
See also: Node::getReferences()
public getReferences ( string $path, string $name = null ) : ArrayIterato\ArrayIterator
$path string the path of the referenced node
$name string name of referring REFERENCE properties to be returned; if null then all referring REFERENCEs are returned
Résultat ArrayIterato\ArrayIterator

getTransport() public méthode

Implementation specific: Transport is used elsewhere, provide it here for Session
public getTransport ( ) : Jackalope\Transport\TransportInterface
Résultat Jackalope\Transport\TransportInterface

getWeakReferences() public méthode

Returns all accessible WEAKREFERENCE properties in the workspace that point to the node
See also: Node::getWeakReferences()
public getWeakReferences ( string $path, string $name = null ) : ArrayIterato\ArrayIterator
$path string the path of the referenced node
$name string name of referring WEAKREFERENCE properties to be returned; if null then all referring WEAKREFERENCEs are returned
Résultat ArrayIterato\ArrayIterator

hasPendingChanges() public méthode

Determine if any object is modified and not saved to storage.
See also: Session::hasPendingChanges()
public hasPendingChanges ( ) : boolean
Résultat boolean true if this session has any pending changes.

isNodeDeleted() public méthode

This is a simplistic check to be used by the Node to determine if it should not show one of the children the backend told it would exist.
See also: Node::__construct
public isNodeDeleted ( string $absPath ) : boolean
$absPath string The absolute path of the node
Résultat boolean true if the current changed state has no node at this place

isNodeMoved() public méthode

This is a simplistic check to be used by the Node to determine if it should not show one of the children the backend told it would exist.
See also: Node::__construct
public isNodeMoved ( string $absPath ) : boolean
$absPath string The absolute path of the node
Résultat boolean true if the node has an unsaved move operation, false otherwise

moveNode() public méthode

WRITE: move node from source path to destination path
See also: Session::move()
public moveNode ( string $srcAbsPath, string $destAbsPath )
$srcAbsPath string Absolute path to the source node.
$destAbsPath string Absolute path to the destination where the node shall be moved to.

moveNodeImmediately() public méthode

Implement the workspace move method. It is dispatched to transport immediately.
See also: Workspace::move()
public moveNodeImmediately ( string $srcAbsPath, string $destAbsPath )
$srcAbsPath string the path of the node to be moved.
$destAbsPath string the location to which the node at srcAbsPath is to be moved.

notifyItems() protected méthode

Notifies the given node and all of its children and properties that a transaction has begun, was committed or rolled back so that the item has a chance to save or restore his internal state.
protected notifyItems ( string $method )
$method string The method to call on each item for the notification (must be beginTransaction, commitTransaction or rollbackTransaction)

pathArrayToPropertiesIterator() protected méthode

Transform an array containing properties paths to an ArrayIterator over Property objects
protected pathArrayToPropertiesIterator ( array $propertyPaths ) : ArrayIterato\ArrayIterator
$propertyPaths array an array of properties paths
Résultat ArrayIterato\ArrayIterator

performNodeRemove() protected méthode

Remove the item at absPath from local cache and keep information for undo.
See also: ObjectManager::removeItem()
protected performNodeRemove ( string $absPath, PHPCR\NodeInterface $node, boolean $sessionOperation = true, $cascading = false )
$absPath string The absolute path of the item that is being removed. Note that contrary to removeItem(), this path is the full path for a property too.
$node PHPCR\NodeInterface The item that is being removed
$sessionOperation boolean whether the node removal should be dispatched immediately or needs to be scheduled in the operations log

performPropertyRemove() protected méthode

Remove the item at absPath from local cache and keep information for undo.
See also: ObjectManager::removeItem()
protected performPropertyRemove ( string $absPath, PHPCR\PropertyInterface $property, boolean $sessionOperation = true )
$absPath string The absolute path of the item that is being removed. Note that contrary to removeItem(), this path is the full path for a property too.
$property PHPCR\PropertyInterface The item that is being removed
$sessionOperation boolean whether the property removal should be dispatched immediately or needs to be scheduled in the operations log

purgeDisappearedNode() public méthode

This is used by Node::refresh() to let the object manager notify deleted nodes or detect cases when not to delete.
public purgeDisappearedNode ( string $absPath, boolean $keepChanges ) : boolean
$absPath string The absolute path of the item
$keepChanges boolean Whether to keep local changes or forget them
Résultat boolean true if the node is to be forgotten by its parent (deleted or moved away), false if child should be kept

refresh() public méthode

Refresh cached items from the backend.
See also: Session::refresh()
public refresh ( boolean $keepChanges )
$keepChanges boolean whether to keep local changes or discard them.

registerNodeTypes() public méthode

This is only a proxy to the transport
public registerNodeTypes ( array $types, boolean $allowUpdate ) : boolean
$types array an array of NodeTypeDefinitions
$allowUpdate boolean whether to fail if node already exists or to update it
Résultat boolean true on success

registerNodeTypesCnd() public méthode

This is only a proxy to the transport
See also: NodeTypeManagerInterface::registerNodeTypesCnd
public registerNodeTypesCnd ( string $cnd, boolean $allowUpdate ) : boolean | Iterator
$cnd string a string with cnd information
$allowUpdate boolean whether to fail if node already exists or to update it
Résultat boolean | Iterator true on success or \Iterator over the registered node types if repository is not able to process CND directly

removeItem() public méthode

If this is a node, sets all cached items below this node to deleted as well. If property is set, the path denotes the node containing the property, otherwise the node at path is removed.
See also: Item::remove()
public removeItem ( string $absPath, PHPCR\PropertyInterface $property = null )
$absPath string The absolute path to the node to be removed, including the node name.
$property PHPCR\PropertyInterface optional, property instance to delete from the given node path. If set, absPath is the path to the node containing this property.

removeItemImmediately() public méthode

Implement the workspace removeItem method.
See also: Workspace::removeItem
public removeItemImmediately ( string $absPath )
$absPath string the absolute path of the item to be removed

removeVersion() public méthode

Remove a version given the path to the version node and the version name.
public removeVersion ( string $versionPath, string $versionName )
$versionPath string The path to the version node
$versionName string The name of the version to remove

removeVersionLabel() public méthode

See also: VersioningInterface::addVersionLabel
public removeVersionLabel ( $path, $label )

restore() public méthode

Clears the node's cache after it has been restored. TODO: This is incomplete. Needs batch processing to implement restoring an array of versions
public restore ( boolean $removeExisting, string $versionPath, string $nodePath )
$removeExisting boolean whether to remove the existing current version or create a new version after that version
$versionPath string
$nodePath string absolute path to the node

rewriteItemPaths() protected méthode

This applies both to the cache and to the items themselves so they return the correct value on getPath calls.
protected rewriteItemPaths ( string $curPath, string $newPath )
$curPath string Absolute path of the node to rewrite
$newPath string The new absolute path

rollbackTransaction() public méthode

TODO: Make sure AccessDeniedException is thrown by the transport if corresponding problems occur TODO: restore the in-memory state as it would be if save() was never called during the transaction. The save() method will need to track some undo information for this to be possible.
public rollbackTransaction ( )

save() public méthode

The order is important to avoid conflicts 1. operationsLog 2. commit any other changes If transactions are enabled but we are not currently inside a transaction, the session is responsible to start a transaction to make sure the backend state does not get messed up in case of error.
public save ( )

Property Details

$factory protected_oe property

The factory to instantiate objects
protected FactoryInterface,jackalope $factory
Résultat jackalope\FactoryInterface

$nodesAdd protected_oe property

Keys are the full paths to be added
protected AddNodeOperation[],Jackalope\Transport $nodesAdd
Résultat Jackalope\Transport\AddNodeOperation[]

$nodesMove protected_oe property

Keys are the source paths, values the move operations containing the target path. The objectsByPath array is updated immediately and any getItem and similar requests are rewritten for the transport layer until save() Only nodes can be moved, not properties. Note: Keep in mind that moving also affects all children of the moved node, but we only have the explicitly moved paths in this array. We check on moved parents whenever retrieving a non-cached node.
protected MoveNodeOperation[],Jackalope\Transport $nodesMove
Résultat Jackalope\Transport\MoveNodeOperation[]

$nodesRemove protected_oe property

Keys are the full paths to be removed. Note: Keep in mind that a delete is recursive, but we only have the explicitly deleted paths in this array. We check on deleted parents whenever retrieving a non-cached node.
protected RemoveNodeOperation[],Jackalope\Transport $nodesRemove
Résultat Jackalope\Transport\RemoveNodeOperation[]

$objectsByPath protected_oe property

There is no notion of order here. The order is defined by order in the Node::nodes array.
protected array $objectsByPath
Résultat array

$objectsByUuid protected_oe property

Take care never to put a path in here unless there is a node for that path in objectsByPath.
protected array $objectsByUuid
Résultat array

$operationsLog protected_oe property

Add, remove and move actions need to be saved in the correct order to avoid i.e. adding something where a node has not yet been moved to.
protected Operation[],Jackalope\Transport $operationsLog
Résultat Jackalope\Transport\Operation[]

$propertiesRemove protected_oe property

Keys are the full paths of properties to be removed.
protected RemovePropertyOperation[],Jackalope\Transport $propertiesRemove
Résultat Jackalope\Transport\RemovePropertyOperation[]

$session protected_oe property

protected SessionInterface,PHPCR $session
Résultat PHPCR\SessionInterface

$transport protected_oe property

protected TransportInterface,Jackalope\Transport $transport
Résultat Jackalope\Transport\TransportInterface