Property | Type | Description | |
---|---|---|---|
$available_states | The states an Item can take | ||
$depth | Depth in the workspace graph | ||
$factory | The jackalope object factory for this object | ||
$isNode | Whether this item is a node (otherwise it is a property) | ||
$keepChanges | To know whether to keep changes or not when reloading in dirty state | ||
$name | the node or property name | ||
$new | false if item is read from backend, true if created locally in this session | ||
$objectManager | The object manager to get nodes and properties from | ||
$oldPath | While this item is moved but unsaved, stores the old path for refresh. | ||
$parentPath | Normalized and absolute path to the parent item for convenience. | ||
$path | Normalized and absolute path to this item. | ||
$postDirtyState | The state to take after this dirty node has been refreshed. One of the STATE_ constants | ||
$savedState | The state of the item saved when a transaction is started | ||
$session | The session this item belongs to | ||
$state | The state of the item, one of the STATE_ constants | ||
$valueConverter | PHPCR\Util\ValueConverter |
Method | Description | |
---|---|---|
accept ( PHPCR\ItemVisitorInterface $visitor ) | {@inheritDoc} | |
beginTransaction ( ) | Manage item state when transaction starts. This method is called on every cached item by the ObjectManager. | |
commitTransaction ( ) | Clean up state after a transaction. This method is called on every cached item by the ObjectManager. | |
confirmSaved ( ) | notify this item that it has been saved into the backend. | |
getAncestor ( $depth ) | {@inheritDoc} | |
getDepth ( ) | {@inheritDoc} | |
getName ( ) | {@inheritDoc} | |
getParent ( ) | {@inheritDoc} | |
getPath ( ) | {@inheritDoc} | |
getSession ( ) | {@inheritDoc} | |
getState ( ) : integer | Get the state of the item | |
isClean ( ) : boolean | Whether this item is in STATE_CLEAN (meaning its data is fully synchronized with the backend) | |
isDeleted ( ) : boolean | Whether this item has been deleted and can not be used anymore. | |
isDirty ( ) : boolean | Whether this item is in state dirty. | |
isModified ( ) | {@inheritDoc} | |
isMoved ( ) | {@inheritDoc} | |
isNew ( ) | {@inheritDoc} | |
isNode ( ) | {@inheritDoc} | |
isSame ( PHPCR\ItemInterface $otherItem ) | {@inheritDoc} | |
remove ( ) | {@inheritDoc} | |
revert ( ) | {@inheritDoc} | |
rollbackTransaction ( ) | Adjust the correct item state after a transaction rollback. This method is called on every cached item by the ObjectManager. | |
setClean ( ) | Tell this item it is clean (i.e. it has been refreshed after a modification) | |
setDeleted ( ) | Tell this item it has been deleted and cannot be used anymore | |
setDirty ( boolean $keepChanges = false, $targetState = false ) | Tell this item that it is dirty and needs to be refreshed | |
setModified ( ) | Tell this item that it has been modified. | |
setPath ( string $path, boolean $move = false ) | Set or update the path, depth, name and parent reference |
Method | Description | |
---|---|---|
__construct ( jackalope\FactoryInterface $factory, string $path, jackalope\Session $session, |
Initialize basic information common to nodes and properties | |
checkState ( ) | This function will modify the state of the item as well as refresh it if necessary (i.e. | |
findItemDefinition ( callable $definitions ) : PHPCR\NodeType\ItemDefinitionInterface | Find the matching item definition for this item. | |
refresh ( boolean $keepChanges ) | Updates the state of the current item. |
Method | Description | |
---|---|---|
setState ( integer $state ) | Change the state of the item |
protected __construct ( jackalope\FactoryInterface $factory, string $path, jackalope\Session $session, |
||
$factory | jackalope\FactoryInterface | the object factory |
$path | string | The normalized and absolute path to this item |
$session | jackalope\Session | |
$objectManager | ||
$new | boolean | can be set to true to tell the object that it has been created locally |
public accept ( PHPCR\ItemVisitorInterface $visitor ) | ||
$visitor | PHPCR\ItemVisitorInterface |
public beginTransaction ( ) |
public commitTransaction ( ) |
protected findItemDefinition ( callable $definitions ) : PHPCR\NodeType\ItemDefinitionInterface | ||
$definitions | callable | Function that extracts the ItemDefinitions from a NodeType |
return | PHPCR\NodeType\ItemDefinitionInterface | The definition for this item. |
public isSame ( PHPCR\ItemInterface $otherItem ) | ||
$otherItem | PHPCR\ItemInterface |
# | $savedState | $state | Resulting $state |
---|---|---|---|
1 | DELETED | * | DELETED |
2 | * | DELETED | DELETED |
3 | NEW | * | NEW |
4 | * | MODIFIED | MODIFIED |
5 | MODIFIED | * | MODIFIED |
6 | CLEAN | CLEAN | CLEAN (if the item was not modified in the TRX) |
7 | CLEAN | CLEAN | MODIFIED (if the item was modified in the TRX) |
note: case 7 is handled in Item::setState() by changing $savedState to MODIFIED if $savedState is CLEAN and current state changes to MODIFIED Without this special case, we would miss the situation where a clean node is modified after transaction start and successfully saved, ending up with clean state again. it has to be modified as its different from the backend value. | |||
8 | CLEAN | DIRTY | DIRTY |
9 | DIRTY | * | DIRTY |
public rollbackTransaction ( ) |
public setClean ( ) |
public setDeleted ( ) |
public setModified ( ) |
protected $isNode |
protected $keepChanges |
protected $new |
protected $objectManager |
protected $oldPath |
protected $parentPath |
protected $postDirtyState |
protected $savedState |