phpcr/src/PHPCR/PropertyInterface.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\PropertyInterface

    Package: Default
    The property interface describes how an item property shall look like.

    A Property object represents the smallest granularity of content storage. It has a single parent node and no children. A property consists of a name and a value, or in the case of multi-value properties, a set of values all of the same type.

    The \Traversable interface enables the implementation to be addressed with foreach. Properties have to implement either \IteratorAggregate or \Iterator. The iterator is equivalent to getValue() returning an iterator of all values of this property (which is exactly one except for multi-valued properties). The iterator keys have no significant meaning.

    PHPCR Note: We removed the Value interface and consequently the getValue() and getValues() methods. If you just want the property value in its native type, use getValue, or just NodeInterface::getPropertyValue. The PropertyInterface::getXX methods also work for multi-valued properties. They return arrays in case of multi-valued. PropertyInterface::setValue completely replaces the ValueFactory::createValue method.

    Parent(s)
    \PHPCR\ItemInterface
    Api
     

    Constants

    >VConstant  JCR_PRIMARY_TYPE = "{http://www.jcp.org/jcr/1.0}primaryType"
    A constant for the property name jcr:primaryType (in extended form), declared in node type nt:base.
    Api
     
    >VConstant  JCR_MIXIN_TYPES = "{http://www.jcp.org/jcr/1.0}mixinTypes"
    A constant for the property name jcr:mixinTypes (in extended form), declared in node type nt:base.
    Api
     
    >VConstant  JCR_CONTENT = "{http://www.jcp.org/jcr/1.0}content"
    A constant for the property name jcr:content (in extended form), declared in node type nt:linkedFile.

    Note: jcr:content is also the name of a child node declared in nt:file.

    Api
     
    >VConstant  JCR_DATA = "{http://www.jcp.org/jcr/1.0}data"
    A constant for the property name jcr:data (in extended form), declared in node type nt:resource.
    Api
     
    >VConstant  JCR_PROTOCOL = "{http://www.jcp.org/jcr/1.0}protocol"
    A constant for the property name jcr:protocol (in extended form), declared in node type nt:address.
    Api
     
    >VConstant  JCR_HOST = "{http://www.jcp.org/jcr/1.0}host"
    A constant for the property name jcr:host (in extended form), declared in node type nt:address.
    Api
     
    >VConstant  JCR_PORT = "{http://www.jcp.org/jcr/1.0}port"
    A constant for the property name jcr:port (in extended form), declared in node type nt:address.
    Api
     
    >VConstant  JCR_REPOSITORY = "{http://www.jcp.org/jcr/1.0repository"
    A constant for the property name jcr:repository (in extended form), declared in node type nt:address.
    Api
     
    >VConstant  JCR_WORKSPACE = "{http://www.jcp.org/jcr/1.0}workspace"
    A constant for the property name jcr:workspace (in extended form), declared in node type nt:address.
    Api
     
    >VConstant  JCR_PATH = "{http://www.jcp.org/jcr/1.0}path"
    A constant for the property name jcr:path (in extended form), declared in node type nt:address.
    Api
     
    >VConstant  JCR_ID = "{http://www.jcp.org/jcr/1.0}id"
    A constant for the property name jcr:id (in extended form), declared in node type nt:address.
    Api
     
    >VConstant  JCR_UUID = "{http://www.jcp.org/jcr/1.0}uuid"
    A constant for the property name jcr:uuid (in extended form), declared in node type mix:referenceable.
    Api
     
    >VConstant  JCR_TITLE = "{http://www.jcp.org/jcr/1.0}title"
    A constant for the property name jcr:title (in extended form), declared in node types mix:title and nt:activity.
    Api
     
    >VConstant  JCR_DESCRIPTION = "{http://www.jcp.org/jcr/1.0}description"
    A constant for the property name jcr:description (in extended form), declared in node type mix:title.
    Api
     
    >VConstant  JCR_CREATED = "{http://www.jcp.org/jcr/1.0}created"
    A constant for the property name jcr:created (in extended form), declared in node types mix:created and nt:version.
    Api
     
    >VConstant  JCR_CREATED_BY = "{http://www.jcp.org/jcr/1.0}createdBy"
    A constant for the property name jcr:createdBy (in extended form), declared in node type mix:created.
    Api
     
    >VConstant  JCR_LAST_MODIFIED = "{http://www.jcp.org/jcr/1.0}lastModified"
    A constant for the property name jcr:lastModified (in extended form), declared in node type mix:lastModified.
    Api
     
    >VConstant  JCR_LAST_MODIFIED_BY = "{http://www.jcp.org/jcr/1.0}lastModifiedBy"
    A constant for the property name jcr:lastModifiedBy (in extended form), declared in node type mix:lastModified.
    Api
     
    >VConstant  JCR_LANGUAGE = "{http://www.jcp.org/jcr/1.0}language"
    A constant for the property name jcr:language (in extended form), declared in node types mix:language and nt:query.
    Api
     
    >VConstant  JCR_MIMETYPE = "{http://www.jcp.org/jcr/1.0}mimeType"
    A constant for the property name jcr:mimeType (in extended form), declared in node type mix:mimeType.
    Api
     
    >VConstant  JCR_ENCODING = "{http://www.jcp.org/jcr/1.0}encoding"
    A constant for the property name jcr:encoding (in extended form), declared in node type mix:mimeType.
    Api
     
    >VConstant  JCR_NODE_TYPE_NAME = "{http://www.jcp.org/jcr/1.0}nodeTypeName"
    A constant for the property name jcr:nodeTypeName (in extended form), declared in node type nt:nodeType.
    Api
     
    >VConstant  JCR_SUPERTYPES = "{http://www.jcp.org/jcr/1.0}supertypes"
    A constant for the property name jcr:supertypes (in extended form), declared in node type nt:nodeType.
    Api
     
    >VConstant  JCR_IS_ABSTRACT = "{http://www.jcp.org/jcr/1.0}isAbstract"
    A constant for the property name jcr:isAbstract (in extended form), declared in node type nt:nodeType.
    Api
     
    >VConstant  JCR_IS_MIXIN = "{http://www.jcp.org/jcr/1.0}isMixin"
    A constant for the property name jcr:isMixin (in extended form), declared in node type nt:nodeType.
    Api
     
    >VConstant  JCR_HAS_ORDERABLE_CHILD_NODES = "{http://www.jcp.org/jcr/1.0}hasOrderableChildNodes"
    A constant for the property name jcr:hasOrderableChildNodes (in extended form), declared in node type nt:nodeType.
    Api
     
    >VConstant  JCR_PRIMARY_ITEM_NAME = "{http://www.jcp.org/jcr/1.0}primaryItemName"
    A constant for the property name jcr:primaryItemName (in extended form), declared in node type nt:nodeType.
    Api
     
    >VConstant  JCR_NAME = "{http://www.jcp.org/jcr/1.0}name"
    A constant for the property name jcr:name (in extended form), declared in node types nt:propertyDefinition and nt:childNodeDefinition.
    Api
     
    >VConstant  JCR_AUTOCREATED = "{http://www.jcp.org/jcr/1.0}autoCreated"
    A constant for the property name jcr:autoCreated (in extended form), declared in node types nt:propertyDefinition and nt:childNodeDefinition.
    Api
     
    >VConstant  JCR_MANDATORY = "{http://www.jcp.org/jcr/1.0}mandatory"
    A constant for the property name jcr:mandatory (in extended form), declared in node types nt:propertyDefinition and nt:childNodeDefinition.
    Api
     
    >VConstant  JCR_PROTECTED = "{http://www.jcp.org/jcr/1.0}protected"
    A constant for the property name jcr:protected (in extended form), declared in node types nt:propertyDefinition and nt:childNodeDefinition.
    Api
     
    >VConstant  JCR_ON_PARENT_VERSION = "{http://www.jcp.org/jcr/1.0}onParentVersion"
    A constant for the property name jcr:onParentVersion (in extended form), declared in node types nt:propertyDefinition and nt:childNodeDefinition.
    Api
     
    >VConstant  JCR_REQUIRED_TYPE = "{http://www.jcp.org/jcr/1.0}requiredType"
    A constant for the property name jcr:requiredType (in extended form), declared in node type nt:propertyDefinition.
    Api
     
    >VConstant  JCR_VALUE_CONSTRAINTS = "{http://www.jcp.org/jcr/1.0}valueConstraints"
    A constant for the property name jcr:valueConstraints (in extended form), declared in node type nt:propertyDefinition.
    Api
     
    >VConstant  JCR_DEFAULT_VALUES = "{http://www.jcp.org/jcr/1.0}defaultValues"
    A constant for the property name jcr:defaultValues (in extended form), declared in node type nt:propertyDefinition.
    Api
     
    >VConstant  JCR_MULTIPLE = "{http://www.jcp.org/jcr/1.0}multiple"
    A constant for the property name jcr:multiple (in extended form), declared in node type nt:propertyDefinition.
    Api
     
    >VConstant  JCR_REQUIRED_PRIMARY_TYPES = "{http://www.jcp.org/jcr/1.0}requiredPrimaryTypes"
    A constant for the property name jcr:requiredPrimaryTypes (in extended form), declared in node type nt:childNodeDefinition.
    Api
     
    >VConstant  JCR_DEFAULT_PRIMARY_TYPE = "{http://www.jcp.org/jcr/1.0}defaultPrimaryType"
    A constant for the property name jcr:defaultPrimaryType (in extended form), declared in node type nt:childNodeDefinition.
    Api
     
    >VConstant  JCR_SAME_NAME_SIBLINGS = "{http://www.jcp.org/jcr/1.0}sameNameSiblings"
    A constant for the property name jcr:sameNameSiblings (in extended form), declared in node type nt:childNodeDefinition.
    Api
     
    >VConstant  JCR_LOCK_OWNER = "{http://www.jcp.org/jcr/1.0}lockOwner"
    A constant for the property name jcr:lockOwner (in extended form), declared in node type mix:lockable.
    Api
     
    >VConstant  JCR_LOCK_IS_DEEP = "{http://www.jcp.org/jcr/1.0}lockIsDeep"
    A constant for the property name jcr:lockIsDeep (in extended form), declared in node type mix:lockable.
    Api
     
    >VConstant  JCR_LIFECYCLE_POLICY = "{http://www.jcp.org/jcr/1.0}lifecyclePolicy"
    A constant for the property name jcr:lifecyclePolicy (in extended form), declared in node type mix:lifecycle.
    Api
     
    >VConstant  JCR_CURRENT_LIFECYCLE_STATE = "{http://www.jcp.org/jcr/1.0}currentLifecycleState"
    A constant for the property name jcr:currentLifecycleState (in extended form), declared in node type mix:lifecycle.
    Api
     
    >VConstant  JCR_IS_CHECKED_OUT = "{http://www.jcp.org/jcr/1.0}isCheckedOut"
    A constant for the property name jcr:isCheckedOut (in extended form), declared in node type mix:simpleVersionable.
    Api
     
    >VConstant  JCR_FROZEN_PRIMARY_TYPE = "{http://www.jcp.org/jcr/1.0}frozenPrimaryType"
    A constant for the property name jcr:frozenPrimaryType (in extended form), declared in node type nt:frozenNode.
    Api
     
    >VConstant  JCR_FROZEN_MIXIN_TYPES = "{http://www.jcp.org/jcr/1.0}frozenMixinTypes"
    A constant for the property name jcr:frozenMixinTypes (in extended form), declared in node type nt:frozenNode.
    Api
     
    >VConstant  JCR_FROZEN_UUID = "{http://www.jcp.org/jcr/1.0}frozenUuid"
    A constant for the property name jcr:frozenUuid (in extended form), declared in node type nt:frozenNode.
    Api
     
    >VConstant  JCR_VERSION_HISTORY = "{http://www.jcp.org/jcr/1.0}versionHistory"
    A constant for the property name jcr:versionHistory (in extended form), declared in node type mix:versionable.
    Api
     
    >VConstant  JCR_BASE_VERSION = "{http://www.jcp.org/jcr/1.0}baseVersion"
    A constant for the property name jcr:baseVersion (in extended form), declared in node type mix:versionable.
    Api
     
    >VConstant  JCR_PREDECESSORS = "{http://www.jcp.org/jcr/1.0}predecessors"
    A constant for the property name jcr:predecessors (in extended form), declared in node types mix:versionable and nt:version.
    Api
     
    >VConstant  JCR_MERGE_FAILED = "{http://www.jcp.org/jcr/1.0}mergeFailed"
    A constant for the property name jcr:mergeFailed (in extended form), declared in node type mix:versionable.
    Api
     
    >VConstant  JCR_ACTIVITY = "{http://www.jcp.org/jcr/1.0}activity"
    A constant for the property name jcr:activity (in extended form), declared in node types mix:versionable and nt:version.
    Api
     
    >VConstant  JCR_CONFIGURATION = "{http://www.jcp.org/jcr/1.0}configuration"
    A constant for the property name jcr:configuration (in extended form), declared in node type mix:versionable.
    Api
     
    >VConstant  JCR_VERSIONABLE_UUID = "{http://www.jcp.org/jcr/1.0}versionableUuid"
    A constant for the property name jcr:versionableUuid (in extended form), declared in node type nt:version.
    Api
     
    >VConstant  JCR_COPIED_FROM = "{http://www.jcp.org/jcr/1.0}copiedFrom"
    A constant for the property name jcr:copiedFrom (in extended form), declared in node type nt:version.
    Api
     
    >VConstant  JCR_SUCCESSORS = "{http://www.jcp.org/jcr/1.0}successors"
    A constant for the property name jcr:successors (in extended form), declared in node type nt:version.
    Api
     
    >VConstant  JCR_CHILD_VERSION_HISTORY = "{http://www.jcp.org/jcr/1.0}childVersionHistory"
    A constant for the property name jcr:childVersionHistory (in extended form), declared in node type nt:versionedChild.
    Api
     
    >VConstant  JCR_ROOT = "{http://www.jcp.org/jcr/1.0}root"
    A constant for the property name jcr:root (in extended form), declared in node type nt:configuration.
    Api
     
    >VConstant  JCR_STATEMENT = "{http://www.jcp.org/jcr/1.0}statement"
    A constant for the property name jcr:statement (in extended form), declared in node type nt:query.
    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
     
    methodpublicaddValue(mixed $value) : void

    Appends a value to a multi-value property.

    It is added at the end of the list.

    PHPCR Note: This is a new method not found in Java JCR. In PHP appending to strings is easy and this is more convenient than getting the property and appending to the array and setting again.

    Parameters
    NameTypeDescription
    $valuemixed
    Throws
    ExceptionDescription
    \PHPCR\ValueFormatExceptionif the property is not multi-value.
    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
     
    methodpublicgetBinary() : resource | array

    Returns a Binary representation of the value of this property.

    The Binary object in turn provides methods to access the binary data itself. Uses the standard conversion to binary (see JCR specification).

    Returns
    TypeDescription
    resource | arrayA stream resource if the underlying binary
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif another error occurs
    Details
    Api
     
    methodpublicgetBoolean() : boolean | array

    Returns a boolean representation of the value of this property.

    PHP Note:Keep in mind that according to the specification, not all property types can be converted to boolean. Most actually can not be converted - see PropertyType::convertType(). If you want to know if a value is empty in the PHP sense, use getString() and do your checks on the string.

    Returns
    TypeDescription
    boolean | arrayA boolean representation of the value of this property, or an array of boolean for multi-valued properties.
    Throws
    ExceptionDescription
    \PHPCR\ValueFormatExceptionif conversion to a boolean is not possible
    \PHPCR\RepositoryExceptionif another error occurs
    Details
    Api
     
    methodpublicgetDate() : \DateTime | array

    Returns a \DateTime representation of the value of this property.

    The object returned is a copy of the stored value, so changes to it are not reflected in internal storage.

    Returns
    TypeDescription
    \DateTime | arrayA date representation of the value of this property, or an array of DateTime for multi-valued properties.
    Throws
    ExceptionDescription
    \PHPCR\ValueFormatExceptionif conversion to \DateTime is not possible
    \PHPCR\RepositoryExceptionif another error occurs
    Details
    Api
     
    methodpublicgetDecimal() : string | array

    Returns an arbitrary precision number (encoded as string) representation of this value (a BigDecimal in Java).

    The string must be encoded with the C locale because of http://bugs.php.net/bug.php?id=16532

    Returns
    TypeDescription
    string | arrayA string representation of the value of this property, or an array of strings for multi-valued properties.
    Throws
    ExceptionDescription
    \PHPCR\ValueFormatExceptionif conversion to a number string is not possible
    \PHPCR\RepositoryExceptionif another error occurs
    Details
    Api
     
    methodpublicgetDefinition() : \PHPCR\NodeType\PropertyDefinitionInterface

    Returns the property definition that applies to this property.

    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 or change of this property, a single particular definition is chosen by the implementation. It is that definition that this method returns. How this governing definition is selected upon property creation or change from among others which may have been applicable is an implementation issue and is not covered by this specification.

    Returns
    TypeDescription
    \PHPCR\NodeType\PropertyDefinitionInterfacea PropertyDefinition 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
     
    methodpublicgetDouble() : float | array

    Returns a float representation of the value of this property.

    Returns
    TypeDescription
    float | arrayA float representation of the value of this property, or an array of float for multi-valued properties.
    Throws
    ExceptionDescription
    \PHPCR\ValueFormatExceptionif conversion to a double is not possible
    \PHPCR\RepositoryExceptionif another error occurs
    Details
    Api
     
    methodpublicgetLength() : integer | array

    Returns the length(s) of the value(s) of this property.

    For a BINARY property, getLength returns the number of bytes. For other property types, getLength returns the same value that would be returned by calling strlen() on the value when it has been converted to a STRING according to standard JCR propety type conversion.

    Returns -1 if the implementation cannot determine the length.

    For multi-valuedproperties, the same rules apply, but returns an array of lengths with the same order as the values have in getValue.

    Returns
    TypeDescription
    integer | arraythe length of this value, or an array of lengths for multi-valued properties
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicgetLong() : integer | array

    Returns an integer representation of the value of this property.

    Returns
    TypeDescription
    integer | arrayAn integer representation of the value of this property, or an array of integer for multi-valued properties.
    Throws
    ExceptionDescription
    \PHPCR\ValueFormatExceptionif conversion to integer is not possible
    \PHPCR\RepositoryExceptionif another 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() : \PHPCR\NodeInterface | array

    Gets the node the property refers to by its type.

    If this property is of type REFERENCE, WEAKREFERENCE or PATH (or convertible to one of these types) this method returns the Node to which this property refers. If this property is of type PATH and it contains a relative path, it is interpreted relative to the parent node of this property. For example "." refers to the parent node itself, ".." to the parent of the parent node and "foo" to a sibling node of this property.

    If you do not want to dereference the nodes yet, you can use getString to get the unique ids and use the SessionInterface::getNodeByIdentifier as all referenced nodes are referenciable and thus must have a uuid. If its a PATH property, you will need the node of this property and use getNodes to get the nodes with relative or absolute path.

    Returns
    TypeDescription
    \PHPCR\NodeInterface | arraythe referenced Node, or an array of Nodes for multi-valued properties.
    Throws
    ExceptionDescription
    \PHPCR\ValueFormatExceptionif this property cannot be converted to a referring type (REFERENCE, WEAKREFERENCE or PATH) or if this property is a referring type but is currently part of the frozen state of a version in version storage.
    \PHPCR\ItemNotFoundExceptionIf this property is of type PATH or WEAKREFERENCE and no target node accessible by the current Session exists in this workspace. Note that this applies even if the property is a PATH and a property exists at the specified location. To dereference to a target property (as opposed to a target node), the method PropertyInterface::getProperty() is used.
    \PHPCR\RepositoryExceptionif another 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
     
    methodpublicgetProperty() : \PHPCR\PropertyInterface | array

    Gets the property the property refers to by its type.

    If this property is of type PATH (or convertible to this type) this method returns the Property to which this property refers. If this property contains a relative path, it is interpreted relative to the parent node of this property. Therefore, when resolving such a relative path, the segment "." refers to the parent node itself, ".." to the parent of the parent node and "foo" to a sibling property of this property or this property itself.

    For example, if this property is located at /a/b/c and it has a value of "../d" then this method will return the property at /a/d if such exists.

    Returns
    TypeDescription
    \PHPCR\PropertyInterface | arraythe referenced property, or an array of properties for multi-valued properties.
    Throws
    ExceptionDescription
    \PHPCR\ValueFormatExceptionif this property cannot be converted to a PATH or if this property is a referring type but is currently part of the frozen state of a version in version storage.
    \PHPCR\ItemNotFoundExceptionIf no property accessible by the current Session exists in this workspace at the specified path. Note that this applies even if a node exists at the specified location. To dereference to a target node, the method PropertyInterface::getNode() is used.
    \PHPCR\RepositoryExceptionif another 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
     
    methodpublicgetString() : string | array

    Returns a String representation of the value of this property.

    Returns
    TypeDescription
    string | arrayA string representation of the value of this property, or an array of string for multi-valued properties.
    Throws
    ExceptionDescription
    \PHPCR\ValueFormatExceptionif conversion to a String is not possible
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicgetType() : integer

    Returns the type of this Property.

    Following property types are available:

    • PropertyType::STRING
    • PropertyType::BINARY
    • PropertyType::DATE
    • PropertyType::DOUBLE
    • PropertyType::LONG
    • PropertyType::BOOLEAN
    • PropertyType::NAME
    • PropertyType::PATH
    • PropertyType::REFERENCE
    • PropertyType::WEAKREFERENCE
    • PropertyType::URI

    The type returned is that which was set at property creation. Note that for some property p, the type returned by $p->getType() will differ from the type returned by $p->getDefinition()->getRequiredType() only in the case where the latter returns UNDEFINED. The type of a property instance is never UNDEFINED (it must always have some actual type).

    Returns
    TypeDescription
    integerThe numerical representation of a property type.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs
    Details
    Api
     
    See
    \PHPCR\PropertyType  
    methodpublicgetValue() : mixed

    Get the value in format default for the PropertyType of this property.

    In case of a (WEAK)REFERENCE, the node is dereferenced and returned. For all other cases including PATH, the value is returned as is. If you want to dereference a PATH to a property or node, you need to explicitly call getNode() resp. getProperty().

    PHPCR Note: We dropped the Value interface as its unnecessary with weak typing.

    Returns
    TypeDescription
    mixedvalue of this property, or array in case of multi-value.
    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
     
    methodpublicisMultiple() : boolean

    Determines if the current property is multi-valued.

    Returns true if this property is multi-valued and false if this property is single-valued.

    Returns
    TypeDescription
    booleantrue if this property is multi-valued; false otherwise.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    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
     
    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
     
    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)  
    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  
    methodpublicsetValue(mixed $value, integer $type = null) : void

    Sets the value of this property to the value.

    If the type parameter is present and this implementation supports dynamic re-binding of properties, this property changes its type. First, a conversion of value into that type is attempted with PropertyType::convertType() and if there is no ValueFormatException, the property type changes to the new type. If the node type does not allow the requested type, a ConstraintViolationException is thrown. If the implementation does not support dynamic re-binding, an UnsupportedRepositoryException is thrown if the type parameter is present and different from the current type.

    If no explicit type is given, then the type is derived from the value. (First value in case of multi-valuedproperty.) If the node type allows the type of the parameter, this property changes its type to the type of the value. Otherwise, a conversion of the value into the required type is attempted with PropertyType::convertType()

    If value is of type PropertyInterface, the value of the property is copied into this property. (If type is set, the property value is converted into this type, otherwise the type of the property is used as in the case of no explicit type). This can be used to copy a binary from one property into another without getting the stream. The implemenation should take care to detect the case and copy the binary data directly in the backend for optimal performance.

    The type detection follows PropertyType::determineType. Thus, passing a Node object without an explicit type (REFERENCE or WEAKREFERENCE) will create a REFERENCE property. If the specified node is not referenceable, a ValueFormatException is thrown.

    To create a PATH property with a reference to an other property, you can call setValue with the return value of getPath called on the other property and the PATH type constant. Passing the property itself and the PATH type will convert the value of the property to a path.

    When assigning a stream resource to write a binary property, the client application must leave the stream alone afterwards. The PHPCR implementation is responsible for closing it after saving.

    This method is a session-write and therefore requires a

    save

    to dispatch the change.

    If value is an array: If this property is not multi-valued then a ValueFormatException is thrown immediately.

    PHPCR Note: The Java API defines this method with multiple differing signatures. PHPCR Note: Because we removed the Value interface, this method replaces ValueFactory::createValue.

    Parameters
    NameTypeDescription
    $valuemixed

    The value to set

    $typeinteger

    Type request for the property, optional. Must be a constant from PropertyType

    Throws
    ExceptionDescription
    \PHPCR\ValueFormatExceptionif the type or format of the specified value is incompatible with the type of this property.
    \PHPCR\Version\VersionExceptionif this property belongs to a node that is read-only due to a checked-in node and this implementation performs this validation immediately.
    \PHPCR\Lock\LockExceptionif a lock prevents the setting of the value and this implementation performs this validation immediately.
    \PHPCR\NodeType\ConstraintViolationExceptionif the change would violate a node-type or other constraint and this implementation performs this validation immediately.
    \PHPCR\UnsupportedRepositoryOperationExceptionif the type parameter is set and different from the current type and this implementation does not support dynamic re-binding
    \InvalidArgumentExceptionif the specified DateTime 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.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    Documentation was generated by phpDocumentor 2.0.0a12.