phpcr/src/PHPCR/Version/VersionHistoryInterface.php
Copyright 2008-2011 Karsten Dambekalns karsten@typo3.org
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
\PHPCR\Version\VersionHistoryInterface
It provides convenient access to version history information.
Note: As this extends NodeInterface, foreach still iterates over the children and not over versions. If you want to use a foreach, you can use getAllVersions() to retrieve an iterator over versions.
- Parent(s)
- \PHPCR\NodeInterface < \PHPCR\ItemInterface
- Api
Constants
JCR_CONTENT
= "{http://www.jcp.org/jcr/1.0}content"
This is the name of a child node declared in NodeType nt:file and a property declared in nt:linkedFile.
- Api
- Inherited_from
- \PHPCR\NodeInterface::JCR_CONTENT
JCR_PROPERTY_DEFINITION
= "{http://www.jcp.org/jcr/1.0}propertyDefinition"
- Api
- Inherited_from
- \PHPCR\NodeInterface::JCR_PROPERTY_DEFINITION
JCR_CHILD_NODE_DEFINITION
= "{http://www.jcp.org/jcr/1.0}childNodeDefinition"
- Api
- Inherited_from
- \PHPCR\NodeInterface::JCR_CHILD_NODE_DEFINITION
JCR_ROOT_VERSION
= "{http://www.jcp.org/jcr/1.0}rootVersion"
- Api
- Inherited_from
- \PHPCR\NodeInterface::JCR_ROOT_VERSION
JCR_VERSION_LABELS
= "{http://www.jcp.org/jcr/1.0}versionLabels"
- Api
- Inherited_from
- \PHPCR\NodeInterface::JCR_VERSION_LABELS
JCR_FROZEN_NODE
= "{http://www.jcp.org/jcr/1.0}frozenNode"
- Api
- Inherited_from
- \PHPCR\NodeInterface::JCR_FROZEN_NODE
Methods
accept(\PHPCR\ItemVisitorInterface $visitor) : void
Call the ItemVisitor::visit() method.
Inherited from: \PHPCR\ItemInterface::accept()\PHPCR\NodeInterface::accept()This is less relevant in PHP (Java had it to avoid typecasting in the visitor). We leave it here, to allow sanity checks or other operations an implementation might wants to do.
Name | Type | Description |
---|---|---|
$visitor | \PHPCR\ItemVisitorInterface | The ItemVisitor to be accepted. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
addMixin(string $mixinName) : void
Adds the mixin node type named $mixinName to this node.
Inherited from: \PHPCR\NodeInterface::addMixin()If this node is already of type $mixinName (either due to a previously added mixin or due to its primary type, through inheritance) then this method has no effect. Otherwise $mixinName is added to this node's jcr:mixinTypes property.
Semantically, the new node type may take effect immediately, on dispatch or on persist. The behavior is adopted must be the same as the behavior adopted for NodeInterface::setPrimaryType() and the behavior that occurs when a node is first created.
A ConstraintViolationException is thrown either immediately or on save if a conflict with another assigned mixin or the primary node type occurs or for an implementation-specific reason. Implementations may differ on when this validation is done.
In some implementations it may only be possible to add mixin types before a a node is persisted for the first time. In such cases any later calls to $addMixin will throw a ConstraintViolationException either immediately, on dispatch or on persist.
Name | Type | Description |
---|---|---|
$mixinName | string | the name of the mixin node type to be added |
Exception | Description |
---|---|
\PHPCR\NodeType\NoSuchNodeTypeException | if the specified mixinName is not recognized and this implementation performs this validation immediately instead of waiting until save. |
\PHPCR\NodeType\ConstraintViolationException | if the specified mixin node type is prevented from being assigned. |
\PHPCR\Version\VersionException | if this node is versionable and checked-in or is non-versionable but its nearest versionable ancestor is checked-in and this implementation performs this validation immediately instead of waiting until save. |
\PHPCR\Lock\LockException | if a lock prevents the addition of the mixin and this implementation performs this validation immediately instead of waiting until save. |
\PHPCR\RepositoryException | if another error occurs. |
- Api
addNode(string $relPath, string $primaryNodeTypeName = null) : \PHPCR\NodeInterface
Creates a new node at the specified $relPath
Inherited from: \PHPCR\NodeInterface::addNode()This is session-write method, meaning that the addition of the new node is dispatched upon SessionInterface::save().
The $relPath provided must not have an index on its final element, otherwise a RepositoryException is thrown.
If ordering is supported by the node type of the parent node of the new node then the new node is appended to the end of the child node list.
If $primaryNodeTypeName is specified, this type will be used (or a ConstraintViolationException thrown if this child type is not allowed). Otherwise the new node's primary node type will be determined by the child node definitions in the node types of its parent. This may occur either immediately, on dispatch (save, whether within or without transactions) or on persist (save without transactions, commit within a transaction), depending on the implementation.
Name | Type | Description |
---|---|---|
$relPath | string | The path of the new node to be created. |
$primaryNodeTypeName | string | The name of the primary node type of the new node. Optional. |
Type | Description |
---|---|
\PHPCR\NodeInterface | The node that was added. |
Exception | Description |
---|---|
\PHPCR\ItemExistsException | if an item at the specified path already exists, same-name siblings are not allowed and this implementation performs this validation immediately. |
\PHPCR\PathNotFoundException | if the specified path implies intermediary Nodes that do not exist or the last element of relPath has an index, and this implementation performs this validation immediately. |
\PHPCR\NodeType\ConstraintViolationException | if a node type or implementation-specific constraint is violated or if an attempt is made to add a node as the child of a property and this implementation performs this validation immediately. |
\PHPCR\Version\VersionException | if the node to which the new child is being added is read-only due to a checked-in node and this implementation performs this validation immediately. |
\PHPCR\Lock\LockException | if a lock prevents the addition of the node and this implementation performs this validation immediately instead of waiting until save. |
\InvalidArgumentException | if $relPath is an absolute path |
\PHPCR\RepositoryException | if the last element of relPath has an index or if another error occurs. |
- Api
addNodeAutoNamed(string $nameHint = null, string $primaryNodeTypeName = null) : \PHPCR\NodeInterface
Adds a new node with a system-generated name as a direct child of this node and returns the new node.
Inherited from: \PHPCR\NodeInterface::addNodeAutoNamed()The name of the new node is a system-created JCR name that differs from the names of all currently persisted child nodes and properties of this node. If present, the nameHint is used as the basis for the name of the new node.
This is a session-write method, meaning that the addition of the new node is dispatched upon Session::save
For the method to successfully add the new child node, the effective node type of this node must permit residual child nodes (see section 3.7.2.1 of the JCR 2.1 specification). If this condition is not met, a ConstraintViolationException will be thrown either immediately, on dispatch (save, whether within or without transactions) or on persist (save without transactions, commit within a transaction). Implementations may differ on when this validation is performed.
A VersionException will be thrown either immediately, on dispatch (save, whether within or without transactions) or on persist (save without transactions, commit within a transaction), if the node to which the new child is being added is read-only due to a checked-in node. Implementations may differ on when this validation is performed.
A LockException will be thrown either immediately, on dispatch (save, whether within or without transactions) or on persist (save without transactions, commit within a transaction), if a lock prevents the addition of the node. Implementations may differ on when this validation is performed.
The new node's primary node type will be determined by the residual child node definitions in the node type of this node. This may occur either immediately, on dispatch (save, whether within or without transactions) or on persist (save without transactions, commit within a transaction), depending on the implementation.
If ordering is supported by the node type of this node then the new node is appended to the end of the child node list.
The behavior of name generation for the new node depends on the form of the $nameHint parameter. If $nameHint is:
- null: The new node name will be generated entirely by the repository. The namespace used for the new name may depend on implementation-specific configuration.
- "" (the empty string), ":" (colon) or "{}": The new node name will be in the empty namespace and the local part of the name will be generated by the repository.
- "somePrefix:" where somePrefix is a syntactically valid namespace prefix: The repository will attempt to create a name in the namespace represented by that prefix. If the prefix specified does not exist, then a NameSpaceException is thrown either immediately, on dispatch (save, whether within or without transactions) or on persist (save without transactions, commit within a transaction). If the prefix does exist then the local part of the name is generated by the repository.
- "{someURI}" where someURI is a syntactically valid namespace URI: The repository will attempt to create a name in the namespace specified. If that namespace has no existing local mapping to a prefix then one is automatically created (as per section 3.5.2 of the JCR specification). The local part of the name is generated by the repository.
- "somePrefix:localNameHint" where somePrefix is a syntactically valid namespace prefix and localNameHint is syntactically valid local name: The repository will attempt to create a name in the namespace represented by that prefix as described in (3), above. The local part of the name is generated by the repository using localNameHint as a basis. The way in which the local name is constructed from the hint may vary across implementations.
- "{someURI}localNameHint" where someURI is a syntactically valid namespace URI and localNameHint is syntactically valid local name: The repository will attempt to create a name in the namespace specified as described in (4), above. The local part of the name is generated by the repository using localNameHint as a basis. The way in which the local name is constructed from the hint may vary across implementations.
Name | Type | Description |
---|---|---|
$nameHint | string | A string to be used as the basis for the created name or null. |
$primaryNodeTypeName | string | The primary node type of the new node or null to have the type guessed. |
Type | Description |
---|---|
\PHPCR\NodeInterface | The newly created node. |
Exception | Description |
---|---|
\PHPCR\NodeType\ConstraintViolationException | if this node does not allow residual child nodes and this implementation performs this validation immediately. |
\PHPCR\Version\VersionException | if this node is read-only due to a checked-in node and this implementation performs this validation immediately. |
\PHPCR\Lock\LockException | if a lock prevents the addition of the node and this implementation performs this validation immediately. |
\PHPCR\NamespaceException | if a namespace prefix is provided in the $nameHint which does not exist and this implementation performs this validation immediately. |
- Since
- JCR 2.1
addVersionLabel(string $versionName, string $label, boolean $moveLabel) : void
Adds the specified label to the specified version.
The label must be a JCR name in either qualified or extended form and therefore must conform to the syntax restriction that apply to such names. In particular a colon (:) should not be used unless it is intended as a prefix delimiter in a qualified name.
Adding a version label to a version corresponds to adding a reference property with a name specified by the label parameter to the jcr:versionLabels sub node of the nt:versionHistory node. The reference property points to the nt:version node that represents the specified version.
This is a workspace-write method and therefore the change is made immediately.
Within a particular version history, a given label may appear a maximum of once. If the specified label is already assigned to a version in this history and moveLabel is true then the label is removed from its current location and added to the version with the specified versionName. If m oveLabel is false, then an attempt to add a label that already exists will fail.
A VersionException is thrown if the named version is not in this VersionHistory or if it is the root version (jcr:rootVersion) or if the label specified is not a valid JCR NAME.
Name | Type | Description |
---|---|---|
$versionName | string | the name of the version to which the label is to be added. |
$label | string | the label to be added, a JCR name in either extended or qualified form. |
$moveLabel | boolean | if true, then if label is already assigned to a version in this version history, it is moved to the new version specified; if false, then attempting to assign an already used label will throw a LabelExistsVersionException. |
Exception | Description |
---|---|
\PHPCR\Version\LabelExistsVersionException | if moveLabel is false, and an attempt is made to add a label that already exists in this version history |
\PHPCR\Version\VersionException | if the specified version does not exist in this version history or if the specified version is the root version (jcr:rootVersion). |
\PHPCR\RepositoryException | if another error occurs. |
- Api
canAddMixin(string $mixinName) : boolean
Determine if a mixin node type may be added to the current node.
Inherited from: \PHPCR\NodeInterface::canAddMixin()Returns true if the specified mixin node type called $mixinName can be added to this node. Returns false otherwise. A result of false must be returned in each of the following cases:
- The mixin's definition conflicts with an existing primary or mixin node type of this node.
- This node is versionable and checked-in or is non-versionable and its nearest versionable ancestor is checked-in.
- This node is protected (as defined in this node's NodeDefinition, found in the node type of this node's parent).
- An access control restriction would prevent the addition of the mixin.
- A lock would prevent the addition of the mixin.
- An implementation-specific restriction would prevent the addition of the mixin.
Name | Type | Description |
---|---|---|
$mixinName | string | The name of the mixin to be tested. |
Type | Description |
---|---|
boolean | true if the specified mixin node type, mixinName, can be added to this node; false otherwise. |
Exception | Description |
---|---|
\PHPCR\NodeType\NoSuchNodeTypeException | if the specified mixin node type name is not recognized. |
\PHPCR\RepositoryException | if another error occurs. |
- Api
followLifecycleTransition(string $transition) : void
Causes the lifecycle state of this node to undergo the specified transition.
Inherited from: \PHPCR\NodeInterface::followLifecycleTransition()This method may change the value of the jcr:currentLifecycleState property, in most cases it is expected that the implementation will change the value to that of the passed transition parameter, though this is an implementation-specific issue. If the jcr:currentLifecycleState property is changed the change is persisted immediately, there is no need to call save.
Name | Type | Description |
---|---|---|
$transition | string | a state transition |
Exception | Description |
---|---|
\PHPCR\UnsupportedRepositoryOperationException | if this implementation does not support lifecycle actions or if this node does not have the mix:lifecycle mixin. |
\PHPCR\InvalidLifecycleTransitionException | if the lifecycle transition is not successful. |
\PHPCR\RepositoryException | if another error occurs. |
- Api
getAllFrozenNodes() : \Iterator
Returns an iterator over all the frozen nodes of all the versions of this version history.
Under simple versioning the order of the returned nodes will be the order of their creation. Under full versioning the order is implementation-dependent.
Type | Description |
---|---|
\Iterator | implementing <b>SeekableIterator</b> and <b>Countable</b>. Values are the NodeInterface instances. Keys are the version names |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
getAllLinearFrozenNodes() : \Iterator
This method returns all the frozen nodes of all the versions in this verison history in the same order as getAllLinearVersions().
Type | Description |
---|---|
\Iterator | implementing <b>SeekableIterator</b> and <b>Countable</b>. Values are the NodeInterface instances. Keys are the version names |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
getAllLinearVersions() : \Iterator
This method returns an iterator over all the versions in the line of descent from the root version to that base version within this history that is bound to the workspace through which this VersionHistory was accessed.
Within a version history H, B is the base version bound to workspace W if and only if there exists a versionable node N in W whose version history is H and B is the base version of N.
The line of descent from version V1 to V2, where V2 is a successor of V1, is the ordered list of versions starting with V1 and proceeding through each direct successor to V2.
The versions are returned in order of creation date, from oldest to newest.
Note that in a simple versioning repository the behavior of this method is equivalent to returning all versions in the version history in order from oldest to newest.
Type | Description |
---|---|
\Iterator | implementing <b>SeekableIterator</b> and <b>Countable</b>. Values are the VersionInterface instances. Keys are the version names. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
getAllVersions() : \Iterator
Returns an iterator over all the versions within this version history.
If the version graph of this history is linear then the versions are returned in order of creation date, from oldest to newest. Otherwise the order of the returned versions is implementation-dependent.
Type | Description |
---|---|
\Iterator | implementing <b>SeekableIterator</b> and <b>Countable</b>. Values are the VersionInterface instances. Keys are the version names. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
getAllowedLifecycleTransitions() : array
Returns the list of valid state transitions for this node.
Inherited from: \PHPCR\NodeInterface::getAllowedLifecycleTransitions()Type | Description |
---|---|
array | a string array. |
Exception | Description |
---|---|
\PHPCR\UnsupportedRepositoryOperationException | if this implementation does not support lifecycle actions or if this node does not have the mix:lifecycle mixin. |
\PHPCR\RepositoryException | if another error occurs. |
- Api
getAncestor(integer $depth) : \PHPCR\ItemInterface
Returns the ancestor of this Item at the specified depth.
Inherited from: \PHPCR\ItemInterface::getAncestor()\PHPCR\NodeInterface::getAncestor()An ancestor of depth x is the Item that is x levels down along the path from the root node to this Item.
- depth = 0 returns the root node of a workspace.
- depth = 1 returns the child of the root node along the path to this Item.
- depth = 2 returns the grandchild of the root node along the path to this Item.
- And so on to depth = n, where n is the depth of this Item, which returns this Item itself.
If this node has more than one path (i.e., if it is a descendant of a shared node) then the path used to define the ancestor is implementaion- dependent.
Name | Type | Description |
---|---|---|
$depth | integer | An integer, 0 <= depth <= n where n is the depth of this Item. |
Type | Description |
---|---|
\PHPCR\ItemInterface | The ancestor of this Item at the specified depth. |
Exception | Description |
---|---|
\PHPCR\ItemNotFoundException | if depth < 0 or depth > n where n is the depth of this item. |
\PHPCR\AccessDeniedException | if the current session does not have sufficient access to retrieve the specified node. |
\PHPCR\RepositoryException | if another error occurs. |
- Api
getCorrespondingNodePath(string $workspaceName) : string
Returns the absolute path of the node in the specified workspace that corresponds to this node.
Inherited from: \PHPCR\NodeInterface::getCorrespondingNodePath()Name | Type | Description |
---|---|---|
$workspaceName | string | the name of the workspace. |
Type | Description |
---|---|
string | the absolute path to the corresponding node. |
Exception | Description |
---|---|
\PHPCR\ItemNotFoundException | if no corresponding node is found. |
\PHPCR\NoSuchWorkspaceException | if the workspace is unknown. |
\PHPCR\AccessDeniedException | if the current session has insufficient access capabilities to perform this operation. |
\PHPCR\RepositoryException | if another error occurs. |
- Api
getDefinition() : \PHPCR\NodeType\NodeDefinitionInterface
Returns the node definition that applies to this node.
Inherited from: \PHPCR\NodeInterface::getDefinition()In some cases there may appear to be more than one definition that could apply to this node. However, it is assumed that upon creation of this node, a single particular definition was used and it is that definition that this method returns. How this governing definition is selected upon node creation from among others which may have been applicable is an implementation issue and is not covered by this specification. The NodeDefinition returned when this method is called on the root node of a workspace is also up to the implementation.
Type | Description |
---|---|
\PHPCR\NodeType\NodeDefinitionInterface | a NodeDefinition object. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
getDepth() : integer
Returns the depth of this Item in the workspace item graph.
Inherited from: \PHPCR\ItemInterface::getDepth()\PHPCR\NodeInterface::getDepth()- The root node returns 0.
- A property or child node of the root node returns 1.
- A property or child node of a child node of the root returns 2.
- And so on to this Item.
Type | Description |
---|---|
integer | The depth of this Item in the workspace item graph. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
getIdentifier() : string
Returns the identifier of the current node.
Inherited from: \PHPCR\NodeInterface::getIdentifier()Applies to both referenceable and non-referenceable nodes.
Type | Description |
---|---|
string | the identifier of this node |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
getIndex() : integer
This method returns the index of this node within the ordered set of its same-name sibling nodes.
Inherited from: \PHPCR\NodeInterface::getIndex()This index is the one used to address same-name siblings using the square-bracket notation, e.g., /a[3]/b[4]. Note that the index always starts at 1 (not 0), for compatibility with XPath. As a result, for nodes that do not have same-name-siblings, this method will always return 1.
Type | Description |
---|---|
integer | The index of this node within the ordered set of its same-name sibling nodes. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
getMixinNodeTypes() : array
Returns an array of NodeType objects representing the mixin node types in effect for this node.
Inherited from: \PHPCR\NodeInterface::getMixinNodeTypes()This includes only those mixin types explicitly assigned to this node. It does not include mixin types inherited through the addition of supertypes to the primary type hierarchy or through the addition of supertypes to the type hierarchy of any of the declared mixin types.
Type | Description |
---|---|
array | of \PHPCR\NodeType\NodeTypeInterface objects. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs |
- Api
getName() : string
Returns the name of this Item in qualified form.
Inherited from: \PHPCR\ItemInterface::getName()\PHPCR\NodeInterface::getName()If this Item is the root node of the workspace, an empty string is returned.
Type | Description |
---|---|
string | the name of this Item in qualified form or an empty string if this Item is the root node of a workspace. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
getNode(string $relPath) : \PHPCR\NodeInterface
Returns the node at relPath relative to this node.
Inherited from: \PHPCR\NodeInterface::getNode()If relPath contains a path element that refers to a node with same-name sibling nodes without explicitly including an index using the array-style notation ([x]), then the index [1] is assumed (indexing of same name siblings begins at 1, not 0, in order to preserve compatibility with XPath).
Within the scope of a single Session object, if a Node object has been acquired, any subsequent call of getNode reacquiring the same node must return a Node object reflecting the same state as the earlier Node object. Whether this object is actually the same Node instance, or simply one wrapping the same state, is up to the implementation.
Name | Type | Description |
---|---|---|
$relPath | string | The relative path of the node to retrieve. |
Type | Description |
---|---|
\PHPCR\NodeInterface | The node at relPath. |
Exception | Description |
---|---|
\PHPCR\PathNotFoundException | if no node exists at the specified path or the current Session does not read access to the node at the specified path, or if $relPath is an absolute path |
\PHPCR\RepositoryException | if another error occurs. |
- Api
getNodeNames(string | array $filter = null) : \Iterator
Returns the names of all child nodes of this node accessible through the
current Session
.
Does not include the names of the properties of this
Node
. If the child nodes of this node have an order then the names are returned in that order, otherwise the order is undefined.
If this node has no accessible child nodes, then an empty iterator is returned.
The optional $filter follows the same semantics as the $filter parameter of NodeInterface::getNodes()
Name | Type | Description |
---|---|---|
$filter | string | array | a name pattern or an array of globbing strings. |
Type | Description |
---|---|
\Iterator | over all child node names |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Since
- JCR 2.1
getNodes(string | array $filter = null) : \Iterator
Get a set of nodes gathered by the definition of a filter.
Inherited from: \PHPCR\NodeInterface::getNodes()If $filter is a string: Gets all child nodes of this node accessible through the current Session that match namePattern (if no pattern is given, all accessible child nodes are returned). Does not include properties of this Node. The pattern may be a full name or a partial name with one or more wildcard characters ("*"), or a disjunction (using the "|" character to represent logical OR) of these. For example,
N->getNodes("jcr:* | myapp:report | my doc")
would return an iterator holding all accessible child nodes of N that are either called 'myapp:report', begin with the prefix 'jcr:' or are called 'my doc'.
The substrings within the pattern that are delimited by "|" characters and which may contain wildcard characters ("*") are called "globs".
Note that leading and trailing whitespace around a glob is ignored, but whitespace within a disjunct forms part of the pattern to be matched.
If $filter is an array: Gets all child nodes of this node accessible through the current Session that match one or more of the $filter strings in the passed array.
A glob may be a full name or a partial name with one or more wildcard characters (""). For example, N->getNodes(array("jcr:", "myapp:report", "my doc")) would return an iterator holding all accessible child nodes of N that are either called 'myapp:report', begin with the prefix 'jcr:' or are called 'my doc'.
Note that unlike in the case of the getNodes(
The pattern is matched against the names (not the paths) of the immediate child nodes of this node.
If the child nodes of this node have an order then the names are returned in that order, otherwise the order is undefined.
If this node has no accessible matching child nodes, then an empty iterator is returned.
The same reacquisition semantics apply as with getNode($relPath).
Name | Type | Description |
---|---|---|
$filter | string | array | a name pattern or an array of globbing strings. |
Type | Description |
---|---|
\Iterator | over all (matching) child Nodes implementing <b>SeekableIterator</b> and <b>Countable</b>. Keys are the Node names, values the corresponding NodeInterface instances. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
getParent() : \PHPCR\NodeInterface
Returns the parent of this Item.
Inherited from: \PHPCR\ItemInterface::getParent()\PHPCR\NodeInterface::getParent()Type | Description |
---|---|
\PHPCR\NodeInterface | The parent of this Item. |
Exception | Description |
---|---|
\PHPCR\ItemNotFoundException | if this Item is the root node of a workspace. |
\PHPCR\AccessDeniedException | if the current session does not have sufficient access to retrieve the parent of this item. |
\PHPCR\RepositoryException | if another error occurs. |
- Api
getPath() : string
Returns the normalized absolute path to this item.
Inherited from: \PHPCR\ItemInterface::getPath()\PHPCR\NodeInterface::getPath()Type | Description |
---|---|
string | the normalized absolute path of this Item. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
getPrimaryItem() : \PHPCR\ItemInterface
Returns the primary child item of the current node.
Inherited from: \PHPCR\NodeInterface::getPrimaryItem()The primary node type of this node may specify one child item (child node or property) of this node as the primary child item. This method returns that item.
In cases where the primary child item specifies the name of a set same-name sibling child nodes, the node returned will be the one among the same-name siblings with index [1].
The same reacquisition semantics apply as with getNode(String).
Type | Description |
---|---|
\PHPCR\ItemInterface | the primary child item. |
Exception | Description |
---|---|
\PHPCR\ItemNotFoundException | if this node does not have a primary child item, either because none is declared in the node type or because a declared primary item is not present on this node instance, or because none accessible through the current Session |
\PHPCR\RepositoryException | if another error occurs. |
- Api
getPrimaryNodeType() : \PHPCR\NodeType\NodeTypeInterface
Returns the primary node type in effect for this node.
Inherited from: \PHPCR\NodeInterface::getPrimaryNodeType()Which NodeType is returned when this method is called on the root node of a workspace is up to the implementation.
Type | Description |
---|---|
\PHPCR\NodeType\NodeTypeInterface | a NodeType object. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs |
- Api
getProperties(string | array $filter = null) : \Iterator
Get an iteratable set of properties gathered on behalf of a filter.
Inherited from: \PHPCR\NodeInterface::getProperties()If $filter is a string: Gets all properties of this node accessible through the current Session that match namePattern (if no pattern is given, all accessible properties are returned). Does not include child nodes of this node. The pattern may be a full name or a partial name with one or more wildcard characters ("*"), or a disjunction (using the "|" character to represent logical OR) of these. For example,
$n->getProperties("jcr:* | myapp:name | my doc")
would return an iterator holding all accessible properties of N that are either called 'myapp:name', begin with the prefix 'jcr:' or are called 'my doc'.
The substrings within the pattern that are delimited by "|" characters and which may contain wildcard characters ("*") are called globs.
Note that leading and trailing whitespace around a glob is ignored, but whitespace within a disjunct forms part of the pattern to be matched.
If $filter is an array: Gets all properties of this node accessible through the current Session that match one or more of the $filter strings in the passed array.
A glob may be a full name or a partial name with one or more wildcard characters (""). For example, N->getProperties(array("jcr:", "myapp:report", "my doc")) would return an iterator holding all accessible properties of N that are either called 'myapp:report', begin with the prefix 'jcr:' or are called 'my doc'.
Note that unlike in the case of getProperties(
The pattern is matched against the names (not the paths) of the immediate child properties of this node.
If this node has no accessible matching properties, then an empty iterator is returned.
The same reacquisition semantics apply as with getNode(String).
Name | Type | Description |
---|---|---|
$filter | string | array | a name pattern |
Type | Description |
---|---|
\Iterator | implementing <b>SeekableIterator</b> and <b>Countable</b>. Keys are the property names, values the corresponding PropertyInterface instances. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
getPropertiesValues(string | array $filter = null, boolean $dereference = true) : array
Shortcut for getProperties and then getting the values of the properties.
Inherited from: \PHPCR\NodeInterface::getPropertiesValues()Apart from returning php native values instead of properties, this method has the same semantics as getProperties()
To improve performance, implementations should avoid instantiating the property objects for this method
Name | Type | Description |
---|---|---|
$filter | string | array | a name pattern |
$dereference | boolean | whether to dereference REFERENCE, WEAKREFERENCE and PATH properties or just return id/path strings |
Type | Description |
---|---|
array | Keys are the property names, values the corresponding property value (or array of values in case of multi-valued properties) If $dereference is false, reference properties are uuid strings and path properties path strings instead of the referenced node instances. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
getProperty(string $relPath) : \PHPCR\PropertyInterface
Returns the property at relPath relative to this node.
Inherited from: \PHPCR\NodeInterface::getProperty()The same reacquisition semantics apply as with getNode(String).
Name | Type | Description |
---|---|---|
$relPath | string | The relative path of the property to retrieve. |
Type | Description |
---|---|
\PHPCR\PropertyInterface | The property at relPath. |
Exception | Description |
---|---|
\PHPCR\PathNotFoundException | if no property exists at the specified path or if the current Session does not have read access to the specified property. |
\InvalidArgumentException | if $relPath is an absolute path |
\PHPCR\RepositoryException | if another error occurs. |
- Api
getPropertyValue(string $name, integer $type = null) : mixed
Returns the property of this node with name $name.
Inherited from: \PHPCR\NodeInterface::getPropertyValue()If $type is set, attempts to convert the value to the specified type. This is a shortcut for getProperty()->getXX()
Name | Type | Description |
---|---|---|
$name | string | Name of this property |
$type | integer | Type conversion request, optional. Must be a constant from {@link PropertyType} |
Type | Description |
---|---|
mixed | The value of the property with $name. |
Exception | Description |
---|---|
\PHPCR\PathNotFoundException | if no property exists at the specified path or if the current Session does not have read access to the specified property. |
\PHPCR\ValueFormatException | if the type or format of the property can not be converted to the specified type. |
\PHPCR\RepositoryException | if another error occurs. |
- Api
getPropertyValueWithDefault(string $relPath, mixed $defaultValue) : mixed
If there is a property at $relPath, this method behaves exactly as getPropertyValue with no specified type.
Inherited from: \PHPCR\NodeInterface::getPropertyValueWithDefault()If no property is found at the specified $relPath, then $defaultValue is returned.
The same reacquisition semantics apply as with getProperty()
Name | Type | Description |
---|---|---|
$relPath | string | the relative path to the desired property |
$defaultValue | mixed | the default value if no property $name exists |
Type | Description |
---|---|
mixed | the value of the property at $relPath or $defaultValue |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an unexpected error occurs. |
- Since
- JCR 2.1
getReferences(string $name = null) : \Iterator
This method returns all REFERENCE properties that refer to this node, have the specified name and that are accessible through the current Session.
Inherited from: \PHPCR\NodeInterface::getReferences()If the name parameter is null then all referring REFERENCES are returned regardless of name.
Some implementations may only return properties that have been persisted. Some may return both properties that have been persisted and those that have been dispatched but not persisted (for example, those saved within a transaction but not yet committed) while others implementations may return these two categories of property as well as properties that are still pending and not yet dispatched.
In implementations that support versioning, this method does not return properties that are part of the frozen state of a version in version storage.
If this node has no referring properties with the specified name, an empty iterator is returned.
Name | Type | Description |
---|---|---|
$name | string | Name of referring REFERENCE properties to be returned; if null then all referring REFERENCEs are returned. |
Type | Description |
---|---|
\Iterator | implementing <b>SeekableIterator</b> and <b>Countable</b>. Keys are the property names, values the corresponding PropertyInterface instances. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs |
- Api
getRootVersion() : \PHPCR\Version\VersionInterface
Returns the root version of this version history.
Type | Description |
---|---|
\PHPCR\Version\VersionInterface | a Version object. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
getSession() : \PHPCR\SessionInterface
Returns the Session through which this Item was acquired.
Inherited from: \PHPCR\ItemInterface::getSession()\PHPCR\NodeInterface::getSession()Type | Description |
---|---|
\PHPCR\SessionInterface | the Session through which this Item was acquired. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
getSharedSet() : \Iterator
Returns an iterator over all nodes that are in the shared set of this node.
Inherited from: \PHPCR\NodeInterface::getSharedSet()If this node is not shared then the returned iterator contains only this node.
Type | Description |
---|---|
\Iterator | implementing <b>SeekableIterator</b> and <b>Countable</b>. Keys are the Node names, values the corresponding NodeInterface instances. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
getVersion(string $versionName) : \PHPCR\Version\VersionInterface
Retrieves a particular version from this version history by version name.
Name | Type | Description |
---|---|---|
$versionName | string | a version name |
Type | Description |
---|---|
\PHPCR\Version\VersionInterface | a Version object. |
Exception | Description |
---|---|
\PHPCR\Version\VersionException | if the specified version is not in this version history. |
\PHPCR\RepositoryException | if an error occurs. |
- Api
getVersionByLabel(string $label) : \PHPCR\Version\VersionInterface
Retrieves a particular version from this version history by version label.
Name | Type | Description |
---|---|---|
$label | string | a version label |
Type | Description |
---|---|
\PHPCR\Version\VersionInterface | a Version object. |
Exception | Description |
---|---|
\PHPCR\Version\VersionException | if the specified label is not in this version history. |
\PHPCR\RepositoryException | if an error occurs. |
- Api
getVersionLabels(\PHPCR\Version\VersionInterface $version = null) : array
Returns all version labels of the given version - empty array if none.
If a $version is given returns all version labels of the history or an empty array if there are none.
Note: The Java API defines this with multiple differing signatures.
Name | Type | Description |
---|---|---|
$version | \PHPCR\Version\VersionInterface | a Version object |
Type | Description |
---|---|
array | a string array containing all the labels of the (given) version (history) |
Exception | Description |
---|---|
\PHPCR\Version\VersionException | if the specified version is not in this version history. |
\PHPCR\RepositoryException | if another error occurs. |
- Api
getVersionableIdentifier() : string
Returns the identifier of the versionable node for which this is the version history.
Type | Description |
---|---|
string | the identifier of the versionable node for which this is the version history. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
getWeakReferences(string $name = null) : \Iterator
This method returns all WEAKREFERENCE properties that refer to this node, have the specified name and that are accessible through the current Session.
Inherited from: \PHPCR\NodeInterface::getWeakReferences()If the name parameter is null then all referring WEAKREFERENCE are returned regardless of name.
Some level 2 implementations may only return properties that have been saved (in a transactional setting this includes both those properties that have been saved but not yet committed, as well as properties that have been committed). Other level 2 implementations may additionally return properties that have been added within the current Session but are not yet saved.
In implementations that support versioning, this method does not return properties that are part of the frozen state of a version in version storage.
If this node has no referring properties with the specified name, an empty iterator is returned.
Name | Type | Description |
---|---|---|
$name | string | name of referring WEAKREFERENCE properties to be returned; if null then all referring WEAKREFERENCEs are returned |
Type | Description |
---|---|
\Iterator | implementing <b>SeekableIterator</b> and <b>Countable</b>. Keys are the property names, values the corresponding PropertyInterface instances. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs |
- Api
hasNode(string $relPath) : boolean
Returns true if a node accessible through the current Session exists at relPath and false otherwise.
Name | Type | Description |
---|---|---|
$relPath | string | The path of a (possible) node. |
Type | Description |
---|---|
boolean | true if a node exists at relPath; false otherwise. |
Exception | Description |
---|---|
\InvalidArgumentException | if $relPath is an absolute path |
\PHPCR\RepositoryException | if an error occurs. |
- Api
hasNodes() : boolean
Indicates whether this node has any child nodes.
Inherited from: \PHPCR\NodeInterface::hasNodes()Returns true if this node has one or more child nodes accessible through the current Session; false otherwise.
Type | Description |
---|---|
boolean | true if this node has one or more child nodes; false otherwise. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
hasProperties() : boolean
Indicates whether this node has properties.
Inherited from: \PHPCR\NodeInterface::hasProperties()Returns true if this node has one or more properties accessible through the current Session; false otherwise.
Type | Description |
---|---|
boolean | true if this node has one or more properties; false otherwise. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
hasProperty(string $relPath) : boolean
Indicates whether a property exists at relPath.
Inherited from: \PHPCR\NodeInterface::hasProperty()Returns true if a property accessible through the current Session exists at relPath and false otherwise.
Name | Type | Description |
---|---|---|
$relPath | string | The path of a (possible) property. |
Type | Description |
---|---|
boolean | true if a property exists at relPath; false otherwise. |
Exception | Description |
---|---|
\InvalidArgumentException | if $relPath is an absolute path |
\PHPCR\RepositoryException | if an error occurs. |
- Api
hasVersionLabel(string $label, \PHPCR\Version\VersionInterface $version = null) : boolean
Returns true if the given version has the given label.
If no $version is given returns true if any version in the history has the given label.
The label must be a JCR name in either qualified or extended form.
PHPCR Note: The Java API defines this with multiple differing signatures.
Name | Type | Description |
---|---|---|
$label | string | a version label. A JCR name in either extended or qualified form. |
$version | \PHPCR\Version\VersionInterface | a Version object |
Type | Description |
---|---|
boolean | a boolean. |
Exception | Description |
---|---|
\PHPCR\Version\VersionException | if the specified version is not of this version history. |
\PHPCR\RepositoryException | if another error occurs. |
- Api
isCheckedOut() : boolean
Determine if the current node is currently checked out.
Inherited from: \PHPCR\NodeInterface::isCheckedOut()Returns false if this node is currently in the checked-in state (either due to its own status as a versionable node or due to the effect of a versionable node being checked in above it). Otherwise this method returns true. This includes the case where the repository does not support versioning (and therefore all nodes are always "checked-out", by default).
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
isLocked() : \PHPCR\boolean.
Determine if the current node has been locked.
Inherited from: \PHPCR\NodeInterface::isLocked()Returns true if this node is locked either as a result of a lock held by this node or by a deep lock on a node above this node; otherwise returns false. This includes the case where a repository does not support locking (in which case all nodes are "unlocked" by default).
Type | Description |
---|---|
\PHPCR\boolean. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
isModified() : boolean
Indicates if the current item has been modified.
Inherited from: \PHPCR\ItemInterface::isModified()\PHPCR\NodeInterface::isModified()Returns true if this Item has been saved but has subsequently been modified through the current session and therefore the state of this item as recorded in the session differs from the state of this item as saved. Within a transaction, isModified on an Item may return false (because the Item has been saved since the modification) even if the modification in question is not in persistent storage (because the transaction has not yet been committed).
Note that in read-only implementations, this method will always return false.
Type | Description |
---|---|
boolean | true if this item is modified; false otherwise. |
- Api
isNew() : boolean
Determines if the current item is a new one.
Inherited from: \PHPCR\ItemInterface::isNew()\PHPCR\NodeInterface::isNew()Returns true if this is a new item, meaning that it exists only in transient storage on the Session and has not yet been saved. Within a transaction, isNew on an Item may return false (because the item has been saved) even if that Item is not in persistent storage (because the transaction has not yet been committed).
Note that if an item returns true on isNew, then by definition is parent will return true on isModified.
Note that in read-only implementations, this method will always return false.
Type | Description |
---|---|
boolean | true if this item is new; false otherwise. |
- Api
isNode() : boolean
Indicates whether this Item is a Node or a Property.
Inherited from: \PHPCR\ItemInterface::isNode()\PHPCR\NodeInterface::isNode()Returns true if this Item is a Node; Returns false if this Item is a Property.
Type | Description |
---|---|
boolean | true if this Item is a Node, false if it is a Property. |
- Api
isNodeType(string $nodeTypeName) : boolean
Returns true if this node is of the specified primary node type or mixin type, or a subtype thereof.
Inherited from: \PHPCR\NodeInterface::isNodeType()Returns false otherwise. This method respects the effective node type of the node.
Name | Type | Description |
---|---|---|
$nodeTypeName | string | the name of a node type. |
Type | Description |
---|---|
boolean | true if this node is of the specified primary node type or mixin type, or a subtype thereof. Returns false otherwise. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
isSame(\PHPCR\ItemInterface $otherItem) : boolean
Determines if this Item object represents the same actual workspace item as the object otherItem.
Inherited from: \PHPCR\ItemInterface::isSame()\PHPCR\NodeInterface::isSame()Two Item objects represent the same workspace item if all the following are true:
- Both objects were acquired through Session objects that were created by the same Repository object.
- Both objects were acquired through Session objects bound to the same repository workspace.
- The objects are either both Node objects or both Property objects.
- If they are Node objects, they have the same identifier.
- If they are Property objects they have identical names and isSame() is true of their parent nodes.
This method does not compare the states of the two items. For example, if two Item objects representing the same actual workspace item have been retrieved through two different sessions and one has been modified, then this method will still return true when comparing these two objects. Note that if two Item objects representing the same workspace item are retrieved through the same session they will always reflect the same state.
Name | Type | Description |
---|---|---|
$otherItem | \PHPCR\ItemInterface | the Item object to be tested for identity with this Item. |
Type | Description |
---|---|
boolean | true if this Item object and otherItem represent the same actual repository item; false otherwise. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
orderBefore(string $srcChildRelPath, string $destChildRelPath) : void
Insert a child node before another child identified by its path.
Inherited from: \PHPCR\NodeInterface::orderBefore()If this node supports child node ordering, this method inserts the child node at srcChildRelPath into the child node list at the position immediately before destChildRelPath.
To place the node srcChildRelPath at the end of the list, a destChildRelPath of null is used.
Note that (apart from the case where destChildRelPath is null) both of these arguments must be relative paths of depth one, in other words they are the names of the child nodes, possibly suffixed with an index.
If srcChildRelPath and destChildRelPath are the same, then no change is made.
This is session-write method, meaning that a change made by this method is dispatched on save.
Name | Type | Description |
---|---|---|
$srcChildRelPath | string | the relative path to the child node (that is, name plus possible index) to be moved in the ordering |
$destChildRelPath | string | the the relative path to the child node (that is, name plus possible index) before which the node srcChildRelPath will be placed. |
Exception | Description |
---|---|
\PHPCR\UnsupportedRepositoryOperationException | if ordering is not supported on this node. |
\PHPCR\NodeType\ConstraintViolationException | if an implementation- specific ordering restriction is violated and this implementation performs this validation immediately instead of waiting until save. |
\PHPCR\ItemNotFoundException | if either parameter is not the relative path of a child node of this node. |
\PHPCR\Version\VersionException | if this node is read-only due to a checked-in node and this implementation performs this validation immediately. |
\PHPCR\Lock\LockException | if a lock prevents the re-ordering and this implementation performs this validation immediately. |
\InvalidArgumentException | if $srcChildRelPath is an absolute path or $destChildRelPath is non-null and any of the two paths is of depth more than 1. |
\PHPCR\RepositoryException | if another error occurs. |
- Api
remove() : void
Removes this item (and its subgraph).
Inherited from: \PHPCR\ItemInterface::remove()\PHPCR\NodeInterface::remove()To persist a removal, a save must be performed that includes the (former) parent of the removed item within its scope.
If a node with same-name siblings is removed, this decrements by one the indices of all the siblings with indices greater than that of the removed node. In other words, a removal compacts the array of same-name siblings and causes the minimal re-numbering required to maintain the original order but leave no gaps in the numbering.
Exception | Description |
---|---|
\PHPCR\Version\VersionException | if the parent node of this item is versionable and checked-in or is non-versionable but its nearest versionable ancestor is checked-in and this implementation performs this validation immediately instead of waiting until save. |
\PHPCR\Lock\LockException | if a lock prevents the removal of this item and this implementation performs this validation immediately instead of waiting until save. |
\PHPCR\NodeType\ConstraintViolationException | if removing the specified item would violate a node type or implementation-specific constraint and this implementation performs this validation immediately instead of waiting until save. |
\PHPCR\AccessDeniedException | if this item or an item in its subgraph is currently the target of a REFERENCE property located in this workspace but outside this item's subgraph and the current Session does not have read access to that REFERENCE property or if the current Session does not have sufficient privileges to remove the item. |
\PHPCR\RepositoryException | if another error occurs. |
removeMixin(string $mixinName) : void
Removes the specified mixin node type from this node and removes mixinName from this node's jcr:mixinTypes property.
Inherited from: \PHPCR\NodeInterface::removeMixin()Both the semantic change in effective node type and the persistence of the change to the jcr:mixinTypes property occur on persist.
Name | Type | Description |
---|---|---|
$mixinName | string | the name of the mixin node type to be removed. |
Exception | Description |
---|---|
\PHPCR\NodeType\NoSuchNodeTypeException | if the specified mixinName is not currently assigned to this node and this implementation performs this validation immediately. |
\PHPCR\NodeType\ConstraintViolationException | if the specified mixin node type is prevented from being removed and this implementation performs this validation immediately. |
\PHPCR\Version\VersionException | if this node is read-only due to a checked-in node and this implementation performs this validation immediately. |
\PHPCR\Lock\LockException | if a lock prevents the removal of the mixin and this implementation performs this validation immediately. |
\PHPCR\RepositoryException | if another error occurs. |
- Api
removeShare() : void
Removes this node, but does not remove any other node in the shared set of this node.
Inherited from: \PHPCR\NodeInterface::removeShare()Exception | Description |
---|---|
\PHPCR\Version\VersionException | if the parent node of this item is versionable and checked-in or is non-versionable but its nearest versionable ancestor is checked-in and this implementation performs this validation immediately instead of waiting until save. |
\PHPCR\Lock\LockException | if a lock prevents the removal of this item and this implementation performs this validation immediately instead of waiting until save. |
\PHPCR\NodeType\ConstraintViolationException | if removing the specified item would violate a node type or implementation-specific constraint and this implementation performs this validation immediately instead of waiting until save. |
\PHPCR\RepositoryException | if this node cannot be removed without removing another node in the shared set of this node or another error occurs. |
- Api
- See
- \PHPCR\removeSharedSet()
- See
- \PHPCR\Item::remove()
- See
- \PHPCR\SessionInterface::removeItem
removeSharedSet() : void
Removes this node and every other node in the shared set of this node.
Inherited from: \PHPCR\NodeInterface::removeSharedSet()This removal must be done atomically, i.e., if one of the nodes cannot be removed, the method throws the exception NodeInterface::remove() would have thrown in that case, and none of the nodes are removed.
If this node is not shared this method removes only this node.
Exception | Description |
---|---|
\PHPCR\Version\VersionException | if the parent node of this item is versionable and checked-in or is non-versionable but its nearest versionable ancestor is checked-in and this implementation performs this validation immediately. |
\PHPCR\Lock\LockException | if a lock prevents the removal of this item and this implementation performs this validation immediately. |
\PHPCR\NodeType\ConstraintViolationException | if removing the specified item would violate a node type or implementation-specific constraint and this implementation performs this validation immediately. |
\PHPCR\RepositoryException | if another error occurs. |
- Api
- See
- \PHPCR\removeShare()
- See
- \PHPCR\Item::remove()
- See
- \PHPCR\SessionInterface::removeItem()
removeVersion(string $versionName) : void
Removes the named version from this version history and automatically repairs the version graph.
If the version to be removed is V, V's predecessor set is P and V's successor set is S, then the version graph is repaired s follows:
- For each member of P, remove the reference to V from its successor list and add references to each member of S.
- For each member of S, remove the reference to V from its predecessor list and add references to each member of P.
Note that this change is made immediately; there is no need to call save. In fact, since the the version storage is read-only with respect to normal repository methods, save does not even function in this context.
Name | Type | Description |
---|---|---|
$versionName | string | the name of a version in this version history. |
Exception | Description |
---|---|
\PHPCR\ReferentialIntegrityException | if the specified version is currently the target of a REFERENCE property elsewhere in the repository (not necessarily in this workspace) and the current Session has read access to that REFERENCE property. |
\PHPCR\AccessDeniedException | if the current Session does not have permission to remove the specified version or if the specified version is currently the target of a REFERENCE property elsewhere in the repository (not just in this workspace) and the current Session does not have read access to that REFERENCE property. |
\PHPCR\UnsupportedRepositoryOperationException | if this operation is not supported by the implementation. |
\PHPCR\Version\VersionException | if the named version is not in this version history. |
\PHPCR\RepositoryException | if another error occurs. |
- Api
removeVersionLabel(string $label) : void
Removes the specified label from among the labels of this version history.
The label must be a JCR name in either qualified or extended form. This corresponds to removing a property from the jcr:versionLabels child node of the nt:versionHistory node that represents this version history.
This is a workspace-write method and therefore the change is made immediately.
Name | Type | Description |
---|---|---|
$label | string | a version label. A JCR name in either extended or qualified form. |
Exception | Description |
---|---|
\PHPCR\Version\VersionException | if the name label does not exist in this version history. |
\PHPCR\RepositoryException | if another error occurs. |
- Api
rename(string $newName) : void
The ordering (if any) of this node among it siblings remains unchanged.
This is a session-write method, meaning that the name change is dispatched upon Session::save.
The $newName provided must not have an index, otherwise a RepositoryException is thrown.
An ItemExistsException will be thrown either immediately, on dispatch (save, whether within or without transactions) or on persist (save without transactions, commit within a transaction), if there already exists a sibling item of this node with the specified name and same-name-siblings are not allowed. Implementations may differ on when this validation is performed.
A ConstraintViolationException will be thrown either immediately, on dispatch (save, whether within or without transactions) or on persist (save without transactions, commit within a transaction), if changing the name would violate a node type or implementation-specific constraint. Implementations may differ on when this validation is performed.
A VersionException will be thrown either immediately, on dispatch (save, whether within or without transactions) or on persist (save without transactions, commit within a transaction), if this node is read-only due to a checked-in node. Implementations may differ on when this validation is performed.
A LockException will be thrown either immediately, on dispatch (save, whether within or without transactions) or on persist (save without transactions, commit within a transaction), if a lock prevents the name change of the node. Implementations may differ on when this validation is performed.
Name | Type | Description |
---|---|---|
$newName | string | The new name of this node. |
Exception | Description |
---|---|
\PHPCR\ItemExistsException | if there already exists a sibling item of this node with the specified name, same-name siblings are not allowed and this implementation performs this validation immediately. |
\PHPCR\NodeType\ConstraintViolationException | if a node type or implementation-specific constraint is violated and this implementation performs this validation immediately. |
\PHPCR\Version\VersionException | if this node is read-only due to a checked-in node and this implementation performs this validation immediately. |
\PHPCR\Lock\LockException | if a lock prevents the name change and this implementation performs this validation immediately. |
\PHPCR\RepositoryException | If $newName has an index or if another error occurs. |
- Since
- JCR 2.1
revert() : void
Discard all pending changes on this item and its children.
Inherited from: \PHPCR\ItemInterface::revert()\PHPCR\NodeInterface::revert()This method discards all pending changes currently recorded in this
Session
that apply to this Item or any of its child nodes and properties and returns these items to reflect the current saved state. Outside a transaction this state is simply the current state of persistent storage. Within a transaction, this state will reflect persistent storage as modified by changes that have been saved but not yet committed.
Exception | Description |
---|---|
\PHPCR\InvalidItemStateException | if this Item object
represents a workspace item that has been removed (either by this
session or another). |
\PHPCR\RepositoryException | if another error occurs. |
- Since
- JCR 2.1
setMixins(array $mixinNames) : void
Sets this node's mixin node types to those named in $mixinNames and sets this node's jcr:mixinTypes property accordingly.
Inherited from: \PHPCR\NodeInterface::setMixins()Any previous mixins are removed.
Semantically, the new node type may take effect immediately, on dispatch or on persist. The behavior adopted must be the same as the behavior adopted for setPrimaryType and the behavior that occurs when a node is first created.
This method adds (and if necessary removes) mixins in a single atomic step, avoiding constraint violations that might occur if the steps were done individually. This can be useful when changing node types while preserving existing content.
A
ConstraintViolationException
is thrown either immediately, on dispatch or on persist, if a conflict occurs within the set of assigned mixins or the primary node type or for an implementation-specific reason. Implementations may differ on when this validation is done.
In some implementations it may only be possible to set mixin types before a node is persisted for the first time. In such cases any later calls to setMixins will throw a ConstraintViolationException either immediately, on dispatch or on persist.
A NoSuchNodeTypeException is thrown either immediately, on dispatch or on persist, if one or more of the specified $mixinNames are not recognized. Implementations may differ on when this validation is done.
A VersionException is thrown either immediately, on dispatch or on persist, if this node is read-only due to a checked-in node. Implementations may differ on when this validation is done.
A LockException is thrown either immediately, on dispatch or on persist, if a lock prevents the assignment of the mixins. Implementations may differ on when this validation is done.
Name | Type | Description |
---|---|---|
$mixinNames | array | the names of the mixin node types to be set |
Exception | Description |
---|---|
\PHPCR\NodeType\NoSuchNodeTypeException | If one or more of the specified $mixinNames are not recognized and this implementation performs this validation immediately. |
\PHPCR\NodeType\ConstraintViolationException | if the specified mixin node types create a conflict and this implementation performs this validation immediately. |
\PHPCR\Version\VersionException | if this node is read-only due to a checked-in node and this implementation performs this validation immediately. |
\PHPCR\Lock\LockException | if a lock prevents the assignment of the mixins and this implementation performs this validation immediately. |
\PHPCR\RepositoryException | if another error occurs. |
- Since
- JCR 2.1
setPrimaryType(string $nodeTypeName) : void
Changes the primary node type of this node to nodeTypeName.
Inherited from: \PHPCR\NodeInterface::setPrimaryType()Also immediately changes this node's jcr:primaryType property appropriately. Semantically, the new node type may take effect immediately or on dispatch but must take effect on persist. Whichever behavior is adopted it must be the same as the behavior adopted for addMixin() (see below) and the behavior that occurs when a node is first created.
Name | Type | Description |
---|---|---|
$nodeTypeName | string | the name of the new node type. |
Exception | Description |
---|---|
\PHPCR\NodeType\ConstraintViolationException | if the specified primary node type creates a type conflict and this implementation performs this validation immediately. |
\PHPCR\NodeType\NoSuchNodeTypeException | if the specified nodeTypeName is not recognized and this implementation performs this validation immediately. |
\PHPCR\Version\VersionException | if this node is read-only due to a checked-in node and this implementation performs this validation immediately. |
\PHPCR\Lock\LockException | if a lock prevents the change of the primary node type and this implementation performs this validation immediately. |
\PHPCR\RepositoryException | if another error occurs. |
- Api
setProperty(string $name, mixed $value, integer $type = null) : \PHPCR\PropertyInterface
Defines a value for a property identified by its name.
Inherited from: \PHPCR\NodeInterface::setProperty()Sets the property of this node called $name to the specified value. This method works as factory method to create new properties and as a shortcut for PropertyInterface::setValue()
The type detection logic is exactly the same as in PropertyInterface::setValue
If the property does not yet exist, it is created and its property type determined by the node type of this node. If, based on the name and value passed, there is more than one property definition that applies, the repository chooses one definition according to some implementation- specific criteria.
Once property with name P has been created, the behavior of a subsequent setProperty($p,$v) may differ across implementations. Some repositories may allow P to be dynamically re-bound to a different property definition (based for example, on the new value being of a different type than the original value) while other repositories may not allow such dynamic re-binding.
Passing a null as the second parameter removes the property. It is equivalent to calling remove on the Property object itself. For example, $n->setProperty("P", null) would remove property called "P" of the node $n.
This is a session-write method, meaning that changes made through this method are dispatched on SessionInterface::save().
If $type is given: The behavior of this method is identical to that of setProperty($name, $value) except that the intended property type is explicitly specified.
Note: Have a look at the JSR-283 spec and/or API documentation for more details on what is supposed to happen for different types of values being passed to this method.
Name | Type | Description |
---|---|---|
$name | string | The name of a property of this node |
$value | mixed | The value to be assigned |
$type | integer | The type to set for the property, optional. Must be a constant from {@link PropertyType} |
Type | Description |
---|---|
\PHPCR\PropertyInterface | The new resp. updated Property object |
Exception | Description |
---|---|
\PHPCR\ValueFormatException | if the specified property is a DATE but the value cannot be expressed in the ISO 8601-based format defined in the JCR 2.0 specification and the implementation does not support dates incompatible with that format or if value cannot be converted to the type of the specified property or if the property already exists and is multi-valued. |
\PHPCR\Version\VersionException | if this node is versionable and checked-in or is non-versionable but its nearest versionable ancestor is checked-in and this implementation performs this validation immediately instead of waiting until save. |
\PHPCR\Lock\LockException | if a lock prevents the setting of the property and this implementation performs this validation immediately instead of waiting until save. |
\PHPCR\NodeType\ConstraintViolationException | if the change would violate a node-type or other constraint and this implementation performs this validation immediately instead of waiting until save. |
\PHPCR\UnsupportedRepositoryOperationException | if the type parameter is set and different from the current type and this implementation does not support dynamic re-binding |
\PHPCR\RepositoryException | if another error occurs. |
update(string $srcWorkspace) : void
Updates a node corresponding to the current one in the given workspace.
Inherited from: \PHPCR\NodeInterface::update()If this node does have a corresponding node in the workspace srcWorkspace, then this replaces this node and its subgraph with a clone of the corresponding node and its subgraph. If this node does not have a corresponding node in the workspace srcWorkspace, then the update method has no effect.
If the update succeeds the changes made are persisted immediately, there is no need to call save.
Note that update does not respect the checked-in status of nodes. An update may change a node even if it is currently checked-in (This fact is only relevant in an implementation that supports versioning).
Name | Type | Description |
---|---|---|
$srcWorkspace | string | the name of the source workspace. |
Exception | Description |
---|---|
\PHPCR\NoSuchWorkspaceException | if srcWorkspace does not exist. |
\PHPCR\InvalidItemStateException | if this Session (not necessarily this Node) has pending unsaved changes. |
\PHPCR\AccessDeniedException | if the current session does not have sufficient access to perform the operation. |
\PHPCR\Lock\LockException | if a lock prevents the update. |
\PHPCR\RepositoryException | if another error occurs. |
- Api