PHP Class Jackalope\Property

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.
Inheritance: extends Item, implements IteratorAggregate, implements PHPCR\PropertyInterface
Afficher le fichier Open project: jackalope/jackalope Class Usage Examples

Protected Properties

Свойство Type Description
$definition PHPCR\NodeType\PropertyDefinitionInterface cached instance of the property definition that defines this property
$isMultiple boolean whether this is a multivalue property
$length integer length is only used for binary property, because binary loading is delayed until explicitly requested.
$streams array All binary stream wrapper instances
$type integer the type constant from PropertyType
$value mixed The property value in suitable native format or object
$wrapBinaryStreams boolean flag to know if binary streams should be wrapped or retrieved immediately. this is a per session setting.

Méthodes publiques

Méthode Description
__construct ( jackalope\FactoryInterface $factory, array $data, string $path, jackalope\Session $session, ObjectManager $objectManager, boolean $new = false ) Create a property, either from server data or locally
__destruct ( ) Close all open binary stream wrapper instances on shutdown.
_setLength ( integer $length ) Internally used after refresh from backend to set new length
_setValue ( mixed $value, integer | string $type = PropertyType::UNDEFINED, boolean $constructor = false ) Internally used to set the value of the property without any notification of changes nor state change.
addValue ( $value ) {@inheritDoc}
getBinary ( ) {@inheritDoc}
getBoolean ( ) {@inheritDoc}
getDate ( ) {@inheritDoc}
getDecimal ( ) {@inheritDoc}
getDefinition ( ) {@inheritDoc}
getDouble ( ) {@inheritDoc}
getIterator ( ) : Iterator Provide Traversable interface: redirect to getNodes with no filter
getLength ( ) {@inheritDoc}
getLong ( ) {@inheritDoc}
getNode ( ) {@inheritDoc}
getProperty ( ) {@inheritDoc}
getString ( ) {@inheritDoc}
getType ( ) {@inheritDoc}
getValue ( ) {@inheritDoc}
getValueForStorage ( ) Get the value of this property to store in the storage backend.
isMultiple ( ) {@inheritDoc}
remove ( ) Also unsets internal reference in containing node
setModified ( ) Tell this item that it has been modified.
setValue ( $value, $type = PropertyType::UNDEFINED ) {@inheritDoc}

Méthodes protégées

Méthode Description
refresh ( $keepChanges, $internal = false ) Refresh this property

Private Methods

Méthode Description
getReferencedNodes ( string[] $ids, boolean $weak ) : Node[] Get all nodes for $ids, ordered by that array, with duplicates if there are duplicates in $ids.

Method Details

__construct() public méthode

To indicate a property has newly been created locally, make sure to pass true for the $new parameter. In that case, you should pass an empty array for $data and use setValue afterwards to let the type magic be handled. Then multivalue is determined on setValue For binary properties, the value is the length of the data(s), not the data itself.
public __construct ( jackalope\FactoryInterface $factory, array $data, string $path, jackalope\Session $session, ObjectManager $objectManager, boolean $new = false )
$factory jackalope\FactoryInterface the object factory
$data array array with fields type (integer or string from PropertyType) and value (data for creating the property value - array for multivalue property)
$path string the absolute path of this item
$session jackalope\Session the session instance
$objectManager ObjectManager the objectManager instance - the caller has to take care of registering this item with the object manager
$new boolean optional: set to true to make this property aware its not yet existing on the server. defaults to false

__destruct() public méthode

Close all open binary stream wrapper instances on shutdown.
public __destruct ( )

_setLength() public méthode

Internally used after refresh from backend to set new length
public _setLength ( integer $length )
$length integer the new length of this binary

_setValue() public méthode

Internally used to set the value of the property without any notification of changes nor state change.
See also: Property::setValue()
public _setValue ( mixed $value, integer | string $type = PropertyType::UNDEFINED, boolean $constructor = false )
$value mixed The value to set.
$type integer | string PropertyType constant
$constructor boolean Whether this is called from the constructor.

addValue() public méthode

{@inheritDoc}
public addValue ( $value )

getBinary() public méthode

{@inheritDoc}
public getBinary ( )

getBoolean() public méthode

{@inheritDoc}
public getBoolean ( )

getDate() public méthode

{@inheritDoc}
public getDate ( )

getDecimal() public méthode

{@inheritDoc}
public getDecimal ( )

getDefinition() public méthode

{@inheritDoc}
public getDefinition ( )

getDouble() public méthode

{@inheritDoc}
public getDouble ( )

getIterator() public méthode

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

getLength() public méthode

{@inheritDoc}
public getLength ( )

getLong() public méthode

{@inheritDoc}
public getLong ( )

getNode() public méthode

{@inheritDoc}
public getNode ( )

getProperty() public méthode

{@inheritDoc}
public getProperty ( )

getString() public méthode

{@inheritDoc}
public getString ( )

getType() public méthode

{@inheritDoc}
public getType ( )

getValue() public méthode

{@inheritDoc}
public getValue ( )

getValueForStorage() public méthode

Path and reference properties are not resolved to the node objects. If this is a binary property, from the moment this method has been called the stream will be read from the transport layer again.
public getValueForStorage ( )

isMultiple() public méthode

{@inheritDoc}
public isMultiple ( )

refresh() protected méthode

{@inheritDoc} In Jackalope, this is also called internally to refresh when the node is accessed in state DIRTY. Triggers a reload of the containing node, as a property can only ever be loaded attached to a node. TODO: refactor this if we implement loading single properties
See also: Item::checkState
protected refresh ( $keepChanges, $internal = false )

remove() public méthode

{@inheritDoc}
public remove ( )

setModified() public méthode

Used to make the parent node aware that this property has changed
public setModified ( )

setValue() public méthode

{@inheritDoc}
public setValue ( $value, $type = PropertyType::UNDEFINED )

Property Details

$definition protected_oe property

cached instance of the property definition that defines this property
See also: Property::getDefinition()
protected PropertyDefinitionInterface,PHPCR\NodeType $definition
Résultat PHPCR\NodeType\PropertyDefinitionInterface

$isMultiple protected_oe property

whether this is a multivalue property
protected bool $isMultiple
Résultat boolean

$length protected_oe property

length is only used for binary property, because binary loading is delayed until explicitly requested.
protected int $length
Résultat integer

$streams protected_oe property

All binary stream wrapper instances
protected array $streams
Résultat array

$type protected_oe property

the type constant from PropertyType
protected int $type
Résultat integer

$value protected_oe property

The property value in suitable native format or object
protected mixed $value
Résultat mixed

$wrapBinaryStreams protected_oe property

flag to know if binary streams should be wrapped or retrieved immediately. this is a per session setting.
See also: Property::__construct()
protected bool $wrapBinaryStreams
Résultat boolean