PHP Class Jackalope\Transport\DoctrineDBAL\Client

Author: Benjamin Eberlei ([email protected])
Author: Lukas Kahwe Smith ([email protected])
Inheritance: extends Jackalope\Transport\BaseTransport, implements Jackalope\Transport\QueryInterface, implements Jackalope\Transport\WritingInterface, implements Jackalope\Transport\WorkspaceManagementInterface, implements Jackalope\Transport\NodeTypeManagementInterface, implements Jackalope\Transport\TransactionInterface
Show file Open project: jackalope/jackalope-doctrine-dbal Class Usage Examples

Protected Properties

Property Type Description
$factory Jackalope\FactoryInterface The factory to instantiate objects
$inTransaction boolean
$namespaces null | ArrayObject Using an ArrayObject here so that we can pass this into the NodeProcessor by reference more elegantly
$valueConverter PHPCR\Util\ValueConverter
$workspaceName string

Public Methods

Method Description
__construct ( Jackalope\FactoryInterface $factory, Doctrine\DBAL\Connection $conn )
beginTransaction ( ) {@inheritDoc}
cloneFrom ( $srcWorkspace, $srcAbsPath, $destAbsPath, $removeExisting ) {@inheritDoc}
commitTransaction ( ) {@inheritDoc}
copyNode ( $srcAbsPath, $dstAbsPath, $srcWorkspace = null ) {@inheritDoc}
createWorkspace ( $name, $srcWorkspace = null ) {@inheritDoc}
deleteNodeImmediately ( $path ) {@inheritDoc}
deleteNodes ( array $operations ) {@inheritDoc}
deleteProperties ( array $operations ) {@inheritDoc}
deletePropertyImmediately ( $path ) {@inheritDoc}
deleteWorkspace ( $name ) {@inheritDoc}
finishSave ( ) {@inheritDoc}
getAccessibleWorkspaceNames ( ) {@inheritDoc}
getBinaryStream ( $path ) {@inheritDoc}
getConnection ( ) : Doctrine\DBAL\Connection
getNamespaces ( ) {@inheritDoc}
getNode ( $path ) {@inheritDoc}
getNodeByIdentifier ( $uuid ) {@inheritDoc}
getNodePathForIdentifier ( $uuid, $workspace = null ) {@inheritDoc}
getNodeTypes ( $nodeTypes = [] ) {@inheritDoc}
getNodes ( $paths ) {@inheritDoc}
getNodesByIdentifier ( $identifiers ) {@inheritDoc}
getProperty ( $path ) {@inheritDoc}
getReferences ( $path, $name = null ) {@inheritDoc}
getRepositoryDescriptors ( ) {@inheritDoc}
getSupportedQueryLanguages ( ) {@inheritDoc}
getWeakReferences ( $path, $name = null ) {@inheritDoc}
login ( PHPCR\CredentialsInterface $credentials = null, $workspaceName = null ) {@inheritDoc}
logout ( ) {@inheritDoc}
moveNodeImmediately ( $srcAbsPath, $dstAbspath ) {@inheritDoc}
moveNodes ( array $operations ) {@inheritDoc}
prepareSave ( ) {@inheritDoc}
query ( Query $query ) {@inheritDoc}
registerNamespace ( $prefix, $uri ) {@inheritDoc}
registerNodeTypes ( $types, $allowUpdate ) {@inheritDoc}
reorderChildren ( Node $node ) {@inheritDoc}
rollbackSave ( ) {@inheritDoc}
rollbackTransaction ( ) {@inheritDoc}
setCheckLoginOnServer ( $bool ) Configure whether to check if we are logged in before doing a request.
setNodeTypeManager ( $nodeTypeManager ) {@inheritDoc}
setTransactionTimeout ( integer $seconds ) Sets the default transaction timeout
setUuidGenerator ( Closure $generator ) Set the UUID generator to use. If not set, the phpcr-utils UUIDHelper will be used.
storeNodes ( array $operations ) {@inheritDoc}
unregisterNamespace ( $prefix ) {@inheritDoc}
updateNode ( Node $node, $srcWorkspace ) {@inheritDoc}
updateProperties ( Node $node )

Protected Methods

Method Description
assertLoggedIn ( ) Ensure that we are currently logged in, executing the login in case we did lazy login.
deleteNode ( string $path ) TODO instead of calling the deletes separately, we should batch the delete query but careful with the caching!
deleteProperty ( $path ) {@inheritDoc}
fetchUserNodeTypes ( ) : array Fetch a user-defined node-type definition.
generateUuid ( ) : string
getIdentifier ( string $path, Property[] $properties ) : string Determine a UUID for the node at this path with these properties
getNamespacesObject ( ) : ArrayObject Return the namespaces of the current session as a referenceable ArrayObject.
getUuidGenerator ( ) : callable
mapPropertyFromElement ( DOMElement $propertyNode, stdClass $data ) Map a property from the given property XML node to the given \stdClass node representation
moveNode ( $srcAbsPath, $dstAbsPath ) Execute moving a single node
setNamespaces ( array | ArrayObject $namespaces ) Set the namespaces property to an \ArrayObject instance
storeNode ( string $path, Property[] $properties ) : boolean Make sure we have a uuid and a primaryType, then sync data into the database
workspaceExists ( $workspaceName )
xmlToColumns ( string $xml, array $propertyNames ) : stdClass Convert the node XML to stdClass node representation containing only the given properties
xmlToProps ( string $xml ) : stdClass Convert the node XML to stdClass node representation containing all properties

Private Methods

Method Description
cleanIdentifierCache ( string $root ) Clean all identifiers under path $root.
ensureNamespacesBackup ( ) We need to create an in memory backup when we are inside a transaction so that we can efficiently restore the original state in the namespaces property in case of a rollback.
executeChunkedUpdate ( $query, array $params ) Executes an UPDATE on DBAL while ensuring that we never try to send more than 999 parameters to SQLite
getJcrName ( string $path ) : array
getNamespacePrefixes ( ) : array Get the registered namespace prefixes
getNodeData ( array $row ) : stdClass Convert a node result row to the stdClass representing all raw data.
getNodeProcessor ( ) : NodeProcessor Return the node processor for processing nodes according to their node types.
getNodeReferences ( string $path, string $name = null, boolean $weakReference = false ) : array
getNodesData ( array $rows ) : stdClass[] Build the raw data for a list of database result rows, fetching the additional information in one single query.
getSystemIdForNode ( string $identifier, string $workspaceName = null ) : boolean | string Get the database primary key for node.
initConnection ( ) Initialize the dbal connection lazily
nestNode ( stdClass $ancestor, stdClass $node, array $nodeNames ) Attach a node at a subpath under the ancestor node.
pathExists ( string $path, string $workspaceName = null ) : boolean Determine if a path exists already.
propsToXML ( array $properties ) : array Seperate properties array into an xml and binary data.
registerSqliteFunctions ( PDO $sqliteConnection ) : Client
syncBinaryData ( $nodeId, $binaryData )
syncNode ( string $uuid, string $path, string $type, boolean $isNewNode, Property[] $props = [], array $propsData = [] ) : boolean | string Actually write the node into the database
syncReferences ( array $referencesToUpdate )

Method Details

__construct() public method

public __construct ( Jackalope\FactoryInterface $factory, Doctrine\DBAL\Connection $conn )
$factory Jackalope\FactoryInterface
$conn Doctrine\DBAL\Connection

assertLoggedIn() protected method

Ensure that we are currently logged in, executing the login in case we did lazy login.
protected assertLoggedIn ( )

beginTransaction() public method

{@inheritDoc}
public beginTransaction ( )

cloneFrom() public method

{@inheritDoc}
public cloneFrom ( $srcWorkspace, $srcAbsPath, $destAbsPath, $removeExisting )

commitTransaction() public method

{@inheritDoc}
public commitTransaction ( )

copyNode() public method

{@inheritDoc}
public copyNode ( $srcAbsPath, $dstAbsPath, $srcWorkspace = null )

createWorkspace() public method

{@inheritDoc}
public createWorkspace ( $name, $srcWorkspace = null )

deleteNode() protected method

TODO instead of calling the deletes separately, we should batch the delete query but careful with the caching!
protected deleteNode ( string $path )
$path string node path to delete

deleteNodeImmediately() public method

{@inheritDoc}
public deleteNodeImmediately ( $path )

deleteNodes() public method

{@inheritDoc}
public deleteNodes ( array $operations )
$operations array

deleteProperties() public method

{@inheritDoc}
public deleteProperties ( array $operations )
$operations array

deleteProperty() protected method

{@inheritDoc}
protected deleteProperty ( $path )

deletePropertyImmediately() public method

{@inheritDoc}
public deletePropertyImmediately ( $path )

deleteWorkspace() public method

{@inheritDoc}
public deleteWorkspace ( $name )

fetchUserNodeTypes() protected method

Fetch a user-defined node-type definition.
protected fetchUserNodeTypes ( ) : array
return array

finishSave() public method

{@inheritDoc}
public finishSave ( )

generateUuid() protected method

protected generateUuid ( ) : string
return string a universally unique id.

getAccessibleWorkspaceNames() public method

{@inheritDoc}

getBinaryStream() public method

{@inheritDoc}
public getBinaryStream ( $path )

getConnection() public method

public getConnection ( ) : Doctrine\DBAL\Connection
return Doctrine\DBAL\Connection

getIdentifier() protected method

Determine a UUID for the node at this path with these properties
protected getIdentifier ( string $path, Property[] $properties ) : string
$path string
$properties Jackalope\Property[]
return string a unique id

getNamespaces() public method

{@inheritDoc}
public getNamespaces ( )

getNamespacesObject() protected method

Return the namespaces of the current session as a referenceable ArrayObject.
protected getNamespacesObject ( ) : ArrayObject
return ArrayObject

getNode() public method

{@inheritDoc}
public getNode ( $path )

getNodeByIdentifier() public method

{@inheritDoc}
public getNodeByIdentifier ( $uuid )

getNodePathForIdentifier() public method

{@inheritDoc}
public getNodePathForIdentifier ( $uuid, $workspace = null )

getNodeTypes() public method

{@inheritDoc}
public getNodeTypes ( $nodeTypes = [] )

getNodes() public method

{@inheritDoc}
public getNodes ( $paths )

getNodesByIdentifier() public method

{@inheritDoc}
public getNodesByIdentifier ( $identifiers )

getProperty() public method

{@inheritDoc}
public getProperty ( $path )

getReferences() public method

{@inheritDoc}
public getReferences ( $path, $name = null )

getRepositoryDescriptors() public method

{@inheritDoc}

getSupportedQueryLanguages() public method

{@inheritDoc}

getUuidGenerator() protected method

protected getUuidGenerator ( ) : callable
return callable a uuid generator function.

getWeakReferences() public method

{@inheritDoc}
public getWeakReferences ( $path, $name = null )

login() public method

{@inheritDoc}
public login ( PHPCR\CredentialsInterface $credentials = null, $workspaceName = null )
$credentials PHPCR\CredentialsInterface

logout() public method

{@inheritDoc}
public logout ( )

mapPropertyFromElement() protected method

Map a property from the given property XML node to the given \stdClass node representation
protected mapPropertyFromElement ( DOMElement $propertyNode, stdClass $data )
$propertyNode DOMElement
$data stdClass

moveNode() protected method

Execute moving a single node
protected moveNode ( $srcAbsPath, $dstAbsPath )

moveNodeImmediately() public method

{@inheritDoc}
public moveNodeImmediately ( $srcAbsPath, $dstAbspath )

moveNodes() public method

{@inheritDoc}
public moveNodes ( array $operations )
$operations array

prepareSave() public method

{@inheritDoc}
public prepareSave ( )

query() public method

{@inheritDoc}
public query ( Query $query )
$query Jackalope\Query\Query

registerNamespace() public method

{@inheritDoc}
public registerNamespace ( $prefix, $uri )

registerNodeTypes() public method

{@inheritDoc}
public registerNodeTypes ( $types, $allowUpdate )

reorderChildren() public method

{@inheritDoc}
public reorderChildren ( Node $node )
$node Jackalope\Node

rollbackSave() public method

{@inheritDoc}
public rollbackSave ( )

rollbackTransaction() public method

{@inheritDoc}
public rollbackTransaction ( )

setCheckLoginOnServer() public method

Will improve error reporting at the cost of some round trips.
public setCheckLoginOnServer ( $bool )

setNamespaces() protected method

Set the namespaces property to an \ArrayObject instance
protected setNamespaces ( array | ArrayObject $namespaces )
$namespaces array | ArrayObject

setNodeTypeManager() public method

{@inheritDoc}
public setNodeTypeManager ( $nodeTypeManager )

setTransactionTimeout() public method

Sets the default transaction timeout
public setTransactionTimeout ( integer $seconds )
$seconds integer The value of the timeout in seconds

setUuidGenerator() public method

Set the UUID generator to use. If not set, the phpcr-utils UUIDHelper will be used.
public setUuidGenerator ( Closure $generator )
$generator Closure

storeNode() protected method

Make sure we have a uuid and a primaryType, then sync data into the database
protected storeNode ( string $path, Property[] $properties ) : boolean
$path string the path to store the node at
$properties Jackalope\Property[] the properties of this node
return boolean true on success

storeNodes() public method

{@inheritDoc}
public storeNodes ( array $operations )
$operations array

unregisterNamespace() public method

{@inheritDoc}
public unregisterNamespace ( $prefix )

updateNode() public method

{@inheritDoc}
public updateNode ( Node $node, $srcWorkspace )
$node Jackalope\Node

updateProperties() public method

public updateProperties ( Node $node )
$node Jackalope\Node the node to update

workspaceExists() protected method

protected workspaceExists ( $workspaceName )

xmlToColumns() protected method

Convert the node XML to stdClass node representation containing only the given properties
protected xmlToColumns ( string $xml, array $propertyNames ) : stdClass
$xml string
$propertyNames array
return stdClass

xmlToProps() protected method

Convert the node XML to stdClass node representation containing all properties
protected xmlToProps ( string $xml ) : stdClass
$xml string
return stdClass

Property Details

$factory protected property

The factory to instantiate objects
protected FactoryInterface,Jackalope $factory
return Jackalope\FactoryInterface

$inTransaction protected property

protected bool $inTransaction
return boolean

$namespaces protected property

Using an ArrayObject here so that we can pass this into the NodeProcessor by reference more elegantly
protected null|ArrayObject $namespaces
return null | ArrayObject

$valueConverter protected property

protected ValueConverter,PHPCR\Util $valueConverter
return PHPCR\Util\ValueConverter

$workspaceName protected property

protected string $workspaceName
return string