phpcr/src/PHPCR/NodeInterface.php

Show: PublicProtectedPrivateinherited
    Table of Contents
    This file is part of the PHPCR API and was originally ported from the Java JCR API to PHP by Karsten Dambekalns for the FLOW3 project.

    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.

    License
    Apache Software License 2.0  
    Link
    http://phpcr.github.com/  

    \PHPCR\NodeInterface

    Package: Default
    The Node interface represents a node in a workspace.

    The \Traversable interface enables the implementation to be addressed with foreach. Nodes have to implement either \IteratorAggregate or \Iterator. The iterator is equivalent to getNodes() with no filter, returning a list of all child nodes. Keys are the node names, values the node instances.

    Parent(s)
    \PHPCR\ItemInterface
    Children
    \PHPCR\Version\VersionInterface
    \PHPCR\Version\VersionHistoryInterface
    Api
     

    Constants

    >VConstant  JCR_CONTENT = "{http://www.jcp.org/jcr/1.0}content"
    A constant for the JCR name jcr:content.

    This is the name of a child node declared in NodeType nt:file and a property declared in nt:linkedFile.

    Api
     
    >VConstant  JCR_PROPERTY_DEFINITION = "{http://www.jcp.org/jcr/1.0}propertyDefinition"
    A constant for the node name jcr:propertyDefinition declared in nt:nodeType.
    Api
     
    >VConstant  JCR_CHILD_NODE_DEFINITION = "{http://www.jcp.org/jcr/1.0}childNodeDefinition"
    A constant for the node name jcr:childNodeDefinition declared in nt:nodeType.
    Api
     
    >VConstant  JCR_ROOT_VERSION = "{http://www.jcp.org/jcr/1.0}rootVersion"
    A constant for the node name jcr:rootVersion declared in nt:versionHistory.
    Api
     
    >VConstant  JCR_VERSION_LABELS = "{http://www.jcp.org/jcr/1.0}versionLabels"
    A constant for the node name jcr:versionLabels declared in nt:versionHistory.
    Api
     
    >VConstant  JCR_FROZEN_NODE = "{http://www.jcp.org/jcr/1.0}frozenNode"
    A constant for the node name jcr:frozenNode declared in nt:version.
    Api
     

    Methods

    methodpublicaccept(\PHPCR\ItemVisitorInterface $visitor) : void
    inherited

    Call the ItemVisitor::visit() method.

    Inherited from: \PHPCR\ItemInterface::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.

    Parameters
    NameTypeDescription
    $visitor\PHPCR\ItemVisitorInterface

    The ItemVisitor to be accepted.

    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicaddMixin(string $mixinName) : void

    Adds the mixin node type named $mixinName to this node.

    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.

    Parameters
    NameTypeDescription
    $mixinNamestring

    the name of the mixin node type to be added

    Throws
    ExceptionDescription
    \PHPCR\NodeType\NoSuchNodeTypeExceptionif the specified mixinName is not recognized and this implementation performs this validation immediately instead of waiting until save.
    \PHPCR\NodeType\ConstraintViolationExceptionif the specified mixin node type is prevented from being assigned.
    \PHPCR\Version\VersionExceptionif 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\LockExceptionif a lock prevents the addition of the mixin and this implementation performs this validation immediately instead of waiting until save.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicaddNode(string $relPath, string $primaryNodeTypeName = null) : \PHPCR\NodeInterface

    Creates a new node at the specified $relPath

    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.

    Parameters
    NameTypeDescription
    $relPathstring

    The path of the new node to be created.

    $primaryNodeTypeNamestring

    The name of the primary node type of the new node. Optional.

    Returns
    TypeDescription
    \PHPCR\NodeInterfaceThe node that was added.
    Throws
    ExceptionDescription
    \PHPCR\ItemExistsExceptionif an item at the specified path already exists, same-name siblings are not allowed and this implementation performs this validation immediately.
    \PHPCR\PathNotFoundExceptionif 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\ConstraintViolationExceptionif 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\VersionExceptionif 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\LockExceptionif a lock prevents the addition of the node and this implementation performs this validation immediately instead of waiting until save.
    \InvalidArgumentExceptionif $relPath is an absolute path
    \PHPCR\RepositoryExceptionif the last element of relPath has an index or if another error occurs.
    Details
    Api
     
    methodpublicaddNodeAutoNamed(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.

    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:

    1. 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.
    2. "" (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.
    3. "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.
    4. "{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.
    5. "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.
    6. "{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.
    Parameters
    NameTypeDescription
    $nameHintstring

    A string to be used as the basis for the created name or null.

    $primaryNodeTypeNamestring

    The primary node type of the new node or null to have the type guessed.

    Returns
    TypeDescription
    \PHPCR\NodeInterfaceThe newly created node.
    Throws
    ExceptionDescription
    \PHPCR\NodeType\ConstraintViolationExceptionif this node does not allow residual child nodes and this implementation performs this validation immediately.
    \PHPCR\Version\VersionExceptionif this node is read-only due to a checked-in node and this implementation performs this validation immediately.
    \PHPCR\Lock\LockExceptionif a lock prevents the addition of the node and this implementation performs this validation immediately.
    \PHPCR\NamespaceExceptionif a namespace prefix is provided in the $nameHint which does not exist and this implementation performs this validation immediately.
    Details
    Since
    JCR 2.1  
    methodpubliccanAddMixin(string $mixinName) : boolean

    Determine if a mixin node type may be added to the current node.

    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.
    Parameters
    NameTypeDescription
    $mixinNamestring

    The name of the mixin to be tested.

    Returns
    TypeDescription
    booleantrue if the specified mixin node type, mixinName, can be added to this node; false otherwise.
    Throws
    ExceptionDescription
    \PHPCR\NodeType\NoSuchNodeTypeExceptionif the specified mixin node type name is not recognized.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicfollowLifecycleTransition(string $transition) : void

    Causes the lifecycle state of this node to undergo the specified transition.

    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.

    Parameters
    NameTypeDescription
    $transitionstring

    a state transition

    Throws
    ExceptionDescription
    \PHPCR\UnsupportedRepositoryOperationExceptionif this implementation does not support lifecycle actions or if this node does not have the mix:lifecycle mixin.
    \PHPCR\InvalidLifecycleTransitionExceptionif the lifecycle transition is not successful.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicgetAllowedLifecycleTransitions() : array

    Returns the list of valid state transitions for this node.

    Returns
    TypeDescription
    arraya string array.
    Throws
    ExceptionDescription
    \PHPCR\UnsupportedRepositoryOperationExceptionif this implementation does not support lifecycle actions or if this node does not have the mix:lifecycle mixin.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicgetAncestor(integer $depth) : \PHPCR\ItemInterface
    inherited

    Returns the ancestor of this Item at the specified depth.

    Inherited from: \PHPCR\ItemInterface::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.

    Parameters
    NameTypeDescription
    $depthinteger

    An integer, 0 <= depth <= n where n is the depth of this Item.

    Returns
    TypeDescription
    \PHPCR\ItemInterfaceThe ancestor of this Item at the specified depth.
    Throws
    ExceptionDescription
    \PHPCR\ItemNotFoundExceptionif depth < 0 or depth > n where n is the depth of this item.
    \PHPCR\AccessDeniedExceptionif the current session does not have sufficient access to retrieve the specified node.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicgetCorrespondingNodePath(string $workspaceName) : string

    Returns the absolute path of the node in the specified workspace that corresponds to this node.

    Parameters
    NameTypeDescription
    $workspaceNamestring

    the name of the workspace.

    Returns
    TypeDescription
    stringthe absolute path to the corresponding node.
    Throws
    ExceptionDescription
    \PHPCR\ItemNotFoundExceptionif no corresponding node is found.
    \PHPCR\NoSuchWorkspaceExceptionif the workspace is unknown.
    \PHPCR\AccessDeniedExceptionif the current session has insufficient access capabilities to perform this operation.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicgetDefinition() : \PHPCR\NodeType\NodeDefinitionInterface

    Returns the node definition that applies to this node.

    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.

    Returns
    TypeDescription
    \PHPCR\NodeType\NodeDefinitionInterfacea NodeDefinition object.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicgetDepth() : integer
    inherited

    Returns the depth of this Item in the workspace item graph.

    Inherited from: \PHPCR\ItemInterface::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.
    Returns
    TypeDescription
    integerThe depth of this Item in the workspace item graph.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicgetIdentifier() : string

    Returns the identifier of the current node.

    Applies to both referenceable and non-referenceable nodes.

    Returns
    TypeDescription
    stringthe identifier of this node
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicgetIndex() : integer

    This method returns the index of this node within the ordered set of its same-name sibling nodes.

    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.

    Returns
    TypeDescription
    integerThe index of this node within the ordered set of its same-name sibling nodes.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicgetMixinNodeTypes() : array

    Returns an array of NodeType objects representing the mixin node types in effect for this node.

    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.

    Returns
    TypeDescription
    arrayof \PHPCR\NodeType\NodeTypeInterface objects.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs
    Details
    Api
     
    methodpublicgetName() : string
    inherited

    Returns the name of this Item in qualified form.

    Inherited from: \PHPCR\ItemInterface::getName()

    If this Item is the root node of the workspace, an empty string is returned.

    Returns
    TypeDescription
    stringthe name of this Item in qualified form or an empty string if this Item is the root node of a workspace.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicgetNode(string $relPath) : \PHPCR\NodeInterface

    Returns the node at relPath relative to this node.

    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.

    Parameters
    NameTypeDescription
    $relPathstring

    The relative path of the node to retrieve.

    Returns
    TypeDescription
    \PHPCR\NodeInterfaceThe node at relPath.
    Throws
    ExceptionDescription
    \PHPCR\PathNotFoundExceptionif 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\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicgetNodeNames(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()

    Parameters
    NameTypeDescription
    $filterstring | array

    a name pattern or an array of globbing strings.

    Returns
    TypeDescription
    \Iteratorover all child node names
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Since
    JCR 2.1  
    methodpublicgetNodes(string | array $filter = null) : \Iterator

    Get a set of nodes gathered by the definition of a filter.

    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() leading and trailing whitespace around a glob is not ignored.

    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).

    Parameters
    NameTypeDescription
    $filterstring | array

    a name pattern or an array of globbing strings.

    Returns
    TypeDescription
    \Iteratorover all (matching) child Nodes implementing <b>SeekableIterator</b> and <b>Countable</b>. Keys are the Node names, values the corresponding NodeInterface instances.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicgetParent() : \PHPCR\NodeInterface
    inherited

    Returns the parent of this Item.

    Inherited from: \PHPCR\ItemInterface::getParent()
    Returns
    TypeDescription
    \PHPCR\NodeInterfaceThe parent of this Item.
    Throws
    ExceptionDescription
    \PHPCR\ItemNotFoundExceptionif this Item is the root node of a workspace.
    \PHPCR\AccessDeniedExceptionif the current session does not have sufficient access to retrieve the parent of this item.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicgetPath() : string
    inherited

    Returns the normalized absolute path to this item.

    Inherited from: \PHPCR\ItemInterface::getPath()
    Returns
    TypeDescription
    stringthe normalized absolute path of this Item.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicgetPrimaryItem() : \PHPCR\ItemInterface

    Returns the primary child item of the current node.

    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).

    Returns
    TypeDescription
    \PHPCR\ItemInterfacethe primary child item.
    Throws
    ExceptionDescription
    \PHPCR\ItemNotFoundExceptionif 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\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicgetPrimaryNodeType() : \PHPCR\NodeType\NodeTypeInterface

    Returns the primary node type in effect for this node.

    Which NodeType is returned when this method is called on the root node of a workspace is up to the implementation.

    Returns
    TypeDescription
    \PHPCR\NodeType\NodeTypeInterfacea NodeType object.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs
    Details
    Api
     
    methodpublicgetProperties(string | array $filter = null) : \Iterator

    Get an iteratable set of properties gathered on behalf of a filter.

    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() leading and trailing whitespace around a glob is not ignored.

    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).

    Parameters
    NameTypeDescription
    $filterstring | array

    a name pattern

    Returns
    TypeDescription
    \Iteratorimplementing <b>SeekableIterator</b> and <b>Countable</b>. Keys are the property names, values the corresponding PropertyInterface instances.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicgetPropertiesValues(string | array $filter = null, boolean $dereference = true) : array

    Shortcut for getProperties and then getting the values of the properties.

    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

    Parameters
    NameTypeDescription
    $filterstring | array

    a name pattern

    $dereferenceboolean

    whether to dereference REFERENCE, WEAKREFERENCE and PATH properties or just return id/path strings

    Returns
    TypeDescription
    arrayKeys 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.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    See
    \PHPCR\NodeInterface::getProperties()  
    methodpublicgetProperty(string $relPath) : \PHPCR\PropertyInterface

    Returns the property at relPath relative to this node.

    The same reacquisition semantics apply as with getNode(String).

    Parameters
    NameTypeDescription
    $relPathstring

    The relative path of the property to retrieve.

    Returns
    TypeDescription
    \PHPCR\PropertyInterfaceThe property at relPath.
    Throws
    ExceptionDescription
    \PHPCR\PathNotFoundExceptionif no property exists at the specified path or if the current Session does not have read access to the specified property.
    \InvalidArgumentExceptionif $relPath is an absolute path
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicgetPropertyValue(string $name, integer $type = null) : mixed

    Returns the property of this node with name $name.

    If $type is set, attempts to convert the value to the specified type. This is a shortcut for getProperty()->getXX()

    Parameters
    NameTypeDescription
    $namestring

    Name of this property

    $typeinteger

    Type conversion request, optional. Must be a constant from {@link PropertyType}

    Returns
    TypeDescription
    mixedThe value of the property with $name.
    Throws
    ExceptionDescription
    \PHPCR\PathNotFoundExceptionif no property exists at the specified path or if the current Session does not have read access to the specified property.
    \PHPCR\ValueFormatExceptionif the type or format of the property can not be converted to the specified type.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicgetPropertyValueWithDefault(string $relPath, mixed $defaultValue) : mixed

    If there is a property at $relPath, this method behaves exactly as getPropertyValue with no specified type.

    If no property is found at the specified $relPath, then $defaultValue is returned.

    The same reacquisition semantics apply as with getProperty()

    Parameters
    NameTypeDescription
    $relPathstring

    the relative path to the desired property

    $defaultValuemixed

    the default value if no property $name exists

    Returns
    TypeDescription
    mixedthe value of the property at $relPath or $defaultValue
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an unexpected error occurs.
    Details
    Since
    JCR 2.1  
    methodpublicgetReferences(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.

    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.

    Parameters
    NameTypeDescription
    $namestring

    Name of referring REFERENCE properties to be returned; if null then all referring REFERENCEs are returned.

    Returns
    TypeDescription
    \Iteratorimplementing <b>SeekableIterator</b> and <b>Countable</b>. Keys are the property names, values the corresponding PropertyInterface instances.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs
    Details
    Api
     
    methodpublicgetSession() : \PHPCR\SessionInterface
    inherited

    Returns the Session through which this Item was acquired.

    Inherited from: \PHPCR\ItemInterface::getSession()
    Returns
    TypeDescription
    \PHPCR\SessionInterfacethe Session through which this Item was acquired.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicgetSharedSet() : \Iterator

    Returns an iterator over all nodes that are in the shared set of this node.

    If this node is not shared then the returned iterator contains only this node.

    Returns
    TypeDescription
    \Iteratorimplementing <b>SeekableIterator</b> and <b>Countable</b>. Keys are the Node names, values the corresponding NodeInterface instances.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicgetWeakReferences(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.

    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.

    Parameters
    NameTypeDescription
    $namestring

    name of referring WEAKREFERENCE properties to be returned; if null then all referring WEAKREFERENCEs are returned

    Returns
    TypeDescription
    \Iteratorimplementing <b>SeekableIterator</b> and <b>Countable</b>. Keys are the property names, values the corresponding PropertyInterface instances.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs
    Details
    Api
     
    methodpublichasNode(string $relPath) : boolean

    Indicates whether a node exists at relPath

    Returns true if a node accessible through the current Session exists at relPath and false otherwise.

    Parameters
    NameTypeDescription
    $relPathstring

    The path of a (possible) node.

    Returns
    TypeDescription
    booleantrue if a node exists at relPath; false otherwise.
    Throws
    ExceptionDescription
    \InvalidArgumentExceptionif $relPath is an absolute path
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublichasNodes() : boolean

    Indicates whether this node has any child nodes.

    Returns true if this node has one or more child nodes accessible through the current Session; false otherwise.

    Returns
    TypeDescription
    booleantrue if this node has one or more child nodes; false otherwise.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublichasProperties() : boolean

    Indicates whether this node has properties.

    Returns true if this node has one or more properties accessible through the current Session; false otherwise.

    Returns
    TypeDescription
    booleantrue if this node has one or more properties; false otherwise.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublichasProperty(string $relPath) : boolean

    Indicates whether a property exists at relPath.

    Returns true if a property accessible through the current Session exists at relPath and false otherwise.

    Parameters
    NameTypeDescription
    $relPathstring

    The path of a (possible) property.

    Returns
    TypeDescription
    booleantrue if a property exists at relPath; false otherwise.
    Throws
    ExceptionDescription
    \InvalidArgumentExceptionif $relPath is an absolute path
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicisCheckedOut() : boolean

    Determine if the current node is currently checked out.

    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).

    Returns
    TypeDescription
    boolean
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicisLocked() : \PHPCR\boolean.

    Determine if the current node has been locked.

    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).

    Returns
    TypeDescription
    \PHPCR\boolean.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicisModified() : boolean
    inherited

    Indicates if the current item has been modified.

    Inherited from: \PHPCR\ItemInterface::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.

    Returns
    TypeDescription
    booleantrue if this item is modified; false otherwise.
    Details
    Api
     
    methodpublicisNew() : boolean
    inherited

    Determines if the current item is a new one.

    Inherited from: \PHPCR\ItemInterface::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.

    Returns
    TypeDescription
    booleantrue if this item is new; false otherwise.
    Details
    Api
     
    methodpublicisNode() : boolean
    inherited

    Indicates whether this Item is a Node or a Property.

    Inherited from: \PHPCR\ItemInterface::isNode()

    Returns true if this Item is a Node; Returns false if this Item is a Property.

    Returns
    TypeDescription
    booleantrue if this Item is a Node, false if it is a Property.
    Details
    Api
     
    methodpublicisNodeType(string $nodeTypeName) : boolean

    Returns true if this node is of the specified primary node type or mixin type, or a subtype thereof.

    Returns false otherwise. This method respects the effective node type of the node.

    Parameters
    NameTypeDescription
    $nodeTypeNamestring

    the name of a node type.

    Returns
    TypeDescription
    booleantrue if this node is of the specified primary node type or mixin type, or a subtype thereof. Returns false otherwise.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicisSame(\PHPCR\ItemInterface $otherItem) : boolean
    inherited

    Determines if this Item object represents the same actual workspace item as the object otherItem.

    Inherited from: \PHPCR\ItemInterface::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.

    Parameters
    NameTypeDescription
    $otherItem\PHPCR\ItemInterface

    the Item object to be tested for identity with this Item.

    Returns
    TypeDescription
    booleantrue if this Item object and otherItem represent the same actual repository item; false otherwise.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicorderBefore(string $srcChildRelPath, string $destChildRelPath) : void

    Insert a child node before another child identified by its path.

    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.

    Parameters
    NameTypeDescription
    $srcChildRelPathstring

    the relative path to the child node (that is, name plus possible index) to be moved in the ordering

    $destChildRelPathstring

    the the relative path to the child node (that is, name plus possible index) before which the node srcChildRelPath will be placed.

    Throws
    ExceptionDescription
    \PHPCR\UnsupportedRepositoryOperationExceptionif ordering is not supported on this node.
    \PHPCR\NodeType\ConstraintViolationExceptionif an implementation- specific ordering restriction is violated and this implementation performs this validation immediately instead of waiting until save.
    \PHPCR\ItemNotFoundExceptionif either parameter is not the relative path of a child node of this node.
    \PHPCR\Version\VersionExceptionif this node is read-only due to a checked-in node and this implementation performs this validation immediately.
    \PHPCR\Lock\LockExceptionif a lock prevents the re-ordering and this implementation performs this validation immediately.
    \InvalidArgumentExceptionif $srcChildRelPath is an absolute path or $destChildRelPath is non-null and any of the two paths is of depth more than 1.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicremove() : void
    inherited

    Removes this item (and its subgraph).

    Inherited from: \PHPCR\ItemInterface::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.

    Throws
    ExceptionDescription
    \PHPCR\Version\VersionExceptionif 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\LockExceptionif a lock prevents the removal of this item and this implementation performs this validation immediately instead of waiting until save.
    \PHPCR\NodeType\ConstraintViolationExceptionif 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\AccessDeniedExceptionif 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\RepositoryExceptionif another error occurs.
    Details
    Api
     
    See
    \PHPCR\SessionInterface::removeItem(String)  
    methodpublicremoveMixin(string $mixinName) : void

    Removes the specified mixin node type from this node and removes mixinName from this node's jcr:mixinTypes property.

    Both the semantic change in effective node type and the persistence of the change to the jcr:mixinTypes property occur on persist.

    Parameters
    NameTypeDescription
    $mixinNamestring

    the name of the mixin node type to be removed.

    Throws
    ExceptionDescription
    \PHPCR\NodeType\NoSuchNodeTypeExceptionif the specified mixinName is not currently assigned to this node and this implementation performs this validation immediately.
    \PHPCR\NodeType\ConstraintViolationExceptionif the specified mixin node type is prevented from being removed and this implementation performs this validation immediately.
    \PHPCR\Version\VersionExceptionif this node is read-only due to a checked-in node and this implementation performs this validation immediately.
    \PHPCR\Lock\LockExceptionif a lock prevents the removal of the mixin and this implementation performs this validation immediately.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicremoveShare() : void

    Removes this node, but does not remove any other node in the shared set of this node.

    Throws
    ExceptionDescription
    \PHPCR\Version\VersionExceptionif 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\LockExceptionif a lock prevents the removal of this item and this implementation performs this validation immediately instead of waiting until save.
    \PHPCR\NodeType\ConstraintViolationExceptionif 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\RepositoryExceptionif this node cannot be removed without removing another node in the shared set of this node or another error occurs.
    Details
    Api
     
    See
    \PHPCR\removeSharedSet()  
    See
    \PHPCR\Item::remove()  
    See
    \PHPCR\SessionInterface::removeItem  
    methodpublicremoveSharedSet() : void

    Removes this node and every other node in the shared set of this node.

    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.

    Throws
    ExceptionDescription
    \PHPCR\Version\VersionExceptionif 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\LockExceptionif a lock prevents the removal of this item and this implementation performs this validation immediately.
    \PHPCR\NodeType\ConstraintViolationExceptionif removing the specified item would violate a node type or implementation-specific constraint and this implementation performs this validation immediately.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    See
    \PHPCR\removeShare()  
    See
    \PHPCR\Item::remove()  
    See
    \PHPCR\SessionInterface::removeItem()  
    methodpublicrename(string $newName) : void

    Renames this node to the specified newName.

    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.

    Parameters
    NameTypeDescription
    $newNamestring

    The new name of this node.

    Throws
    ExceptionDescription
    \PHPCR\ItemExistsExceptionif 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\ConstraintViolationExceptionif a node type or implementation-specific constraint is violated and this implementation performs this validation immediately.
    \PHPCR\Version\VersionExceptionif this node is read-only due to a checked-in node and this implementation performs this validation immediately.
    \PHPCR\Lock\LockExceptionif a lock prevents the name change and this implementation performs this validation immediately.
    \PHPCR\RepositoryExceptionIf $newName has an index or if another error occurs.
    Details
    Since
    JCR 2.1  
    methodpublicrevert() : void
    inherited

    Discard all pending changes on this item and its children.

    Inherited from: \PHPCR\ItemInterface::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.

    Throws
    ExceptionDescription
    \PHPCR\InvalidItemStateExceptionif this Item object represents a workspace item that has been removed (either by this session or another).
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Since
    JCR 2.1  
    methodpublicsetMixins(array $mixinNames) : void

    Sets this node's mixin node types to those named in $mixinNames and sets this node's jcr:mixinTypes property accordingly.

    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.

    Parameters
    NameTypeDescription
    $mixinNamesarray

    the names of the mixin node types to be set

    Throws
    ExceptionDescription
    \PHPCR\NodeType\NoSuchNodeTypeExceptionIf one or more of the specified $mixinNames are not recognized and this implementation performs this validation immediately.
    \PHPCR\NodeType\ConstraintViolationExceptionif the specified mixin node types create a conflict and this implementation performs this validation immediately.
    \PHPCR\Version\VersionExceptionif this node is read-only due to a checked-in node and this implementation performs this validation immediately.
    \PHPCR\Lock\LockExceptionif a lock prevents the assignment of the mixins and this implementation performs this validation immediately.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Since
    JCR 2.1  
    methodpublicsetPrimaryType(string $nodeTypeName) : void

    Changes the primary node type of this node to nodeTypeName.

    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.

    Parameters
    NameTypeDescription
    $nodeTypeNamestring

    the name of the new node type.

    Throws
    ExceptionDescription
    \PHPCR\NodeType\ConstraintViolationExceptionif the specified primary node type creates a type conflict and this implementation performs this validation immediately.
    \PHPCR\NodeType\NoSuchNodeTypeExceptionif the specified nodeTypeName is not recognized and this implementation performs this validation immediately.
    \PHPCR\Version\VersionExceptionif this node is read-only due to a checked-in node and this implementation performs this validation immediately.
    \PHPCR\Lock\LockExceptionif a lock prevents the change of the primary node type and this implementation performs this validation immediately.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicsetProperty(string $name, mixed $value, integer $type = null) : \PHPCR\PropertyInterface

    Defines a value for a property identified by its name.

    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.

    Parameters
    NameTypeDescription
    $namestring

    The name of a property of this node

    $valuemixed

    The value to be assigned

    $typeinteger

    The type to set for the property, optional. Must be a constant from {@link PropertyType}

    Returns
    TypeDescription
    \PHPCR\PropertyInterfaceThe new resp. updated Property object
    Throws
    ExceptionDescription
    \PHPCR\ValueFormatExceptionif 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\VersionExceptionif 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\LockExceptionif a lock prevents the setting of the property and this implementation performs this validation immediately instead of waiting until save.
    \PHPCR\NodeType\ConstraintViolationExceptionif the change would violate a node-type or other constraint and this implementation performs this validation immediately instead of waiting until save.
    \PHPCR\UnsupportedRepositoryOperationExceptionif the type parameter is set and different from the current type and this implementation does not support dynamic re-binding
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    See
    \PHPCR\PropertyInterface::setValue()  
    methodpublicupdate(string $srcWorkspace) : void

    Updates a node corresponding to the current one in the given workspace.

    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).

    Parameters
    NameTypeDescription
    $srcWorkspacestring

    the name of the source workspace.

    Throws
    ExceptionDescription
    \PHPCR\NoSuchWorkspaceExceptionif srcWorkspace does not exist.
    \PHPCR\InvalidItemStateExceptionif this Session (not necessarily this Node) has pending unsaved changes.
    \PHPCR\AccessDeniedExceptionif the current session does not have sufficient access to perform the operation.
    \PHPCR\Lock\LockExceptionif a lock prevents the update.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    Documentation was generated by phpDocumentor 2.0.0a12.