PHP Интерфейс Jackalope\Transport\TransportInterface

Note that the JCR Repository Compliance specification defines a larger set of functions, but we want Jackalope to even work with very minimalistic backends. See the README.md in this folder for general information about the transport layer. This interface is now synchronized with what we had for davex as per 2011-12-28 TODO: keep this in sync with Transport/Jackrabbit/Client.php
Показать файл Открыть проект Примеры использования интерфейса

Открытые методы

Метод Описание
getAccessibleWorkspaceNames ( ) : array Returns the workspace names that can be used when logging in.
getAutoLastModified ( ) : boolean Get the auto last modified flag.
getBinaryStream ( string $path ) : resource Retrieve a stream of a binary property value
getFetchDepth ( ) : integer Returns the current fetchDepth
getNamespaces ( ) : array Get the registered namespaces mappings from the backend.
getNode ( string $path ) : array Get the node from an absolute path
getNodeByIdentifier ( string $uuid ) : array Get the node from a uuid. Same data format as getNode, but additionally must have the :jcr:path property.
getNodePathForIdentifier ( string $uuid, string $workspace = null ) : string Get the node path from a JCR uuid. This is mainly useful for cross-workspace functionality like clone or updateFrom.
getNodeTypes ( $nodeTypes = [] ) : array Get node types, either filtered or all.
getNodes ( array $paths ) : array Get the nodes from an array of absolute paths.
getNodesByIdentifier ( array $identifiers ) : array Get the nodes from an array of uuid.
getProperty ( string $path ) : stdClass Get the property stored at an absolute path.
getReferences ( string $path, string $name = null ) : array Returns the path of all accessible REFERENCE properties in the workspace that point to the node
getRepositoryDescriptors ( ) : array Get all repository descriptors
getWeakReferences ( string $path, string $name = null ) : array Returns the path of all accessible WEAKREFERENCE properties in the workspace that point to the node
login ( PHPCR\CredentialsInterface $credentials = null, string $workspaceName = null ) : string Set this transport to a specific credential and a workspace.
logout ( ) Releases all resources associated with this Session.
setAutoLastModified ( boolean $autoLastModified ) Set whether to automatically update nodes having mix:lastModified.
setFetchDepth ( integer $depth ) Sets the depth with which a transport should fetch childnodes If depth = 0 it only fetches the requested node If depth = 1 it also fetches its children If depth = 2 it also fetches its children and grandchildren and so on
setNodeTypeManager ( NodeTypeManager $nodeTypeManager ) Pass the node type manager into the transport to be used for validation and such.

Описание методов

getAccessibleWorkspaceNames() публичный Метод

Returns the workspace names that can be used when logging in.
public getAccessibleWorkspaceNames ( ) : array
Результат array List of workspaces that can be specified on login

getAutoLastModified() публичный Метод

Get the auto last modified flag.
public getAutoLastModified ( ) : boolean
Результат boolean Whether to update the last modified information.

getBinaryStream() публичный Метод

Retrieve a stream of a binary property value
public getBinaryStream ( string $path ) : resource
$path string absolute path to the property containing binary data
Результат resource with binary data

getFetchDepth() публичный Метод

Returns the current fetchDepth
public getFetchDepth ( ) : integer
Результат integer with the current fetchDepth

getNamespaces() публичный Метод

Returns all additional namespaces. Does not return the ones defined as constants in \PHPCR\NamespaceRegistryInterface
public getNamespaces ( ) : array
Результат array Associative array of prefix => uri

getNode() публичный Метод

Returns a json_decode stdClass structure that contains two fields for each property and one field for each child. A child is just containing an empty class as value (in the future we could use this for eager loading with recursive structure). A property consists of a field named as the property is and a value that is the property value, plus a second field with the same name but prefixed with a colon that has a type specified as value (out of the string constants from PropertyType) For binary properties, the value of the type declaration is not the type but the length of the binary, thus integer instead of string. There is no value field for binary data (to avoid loading large amount of unneeded data) Use getBinaryStream to get the actual data of a binary property. If prefetch is active, eventual children to be cached may be included as stdClass children. This can be several levels deep, depending on the prefetch setting. There is a couple of "magic" properties:
  • jcr:uuid - the unique id of the node
  • jcr:primaryType - name of the primary type
  • jcr:mixinTypes - comma separated list of mixin types
  • jcr:index - the index of same name siblings
public getNode ( string $path ) : array
$path string Absolute path to the node.
Результат array associative array for the node (decoded from json with associative = true)

getNodeByIdentifier() публичный Метод

Get the node from a uuid. Same data format as getNode, but additionally must have the :jcr:path property.
public getNodeByIdentifier ( string $uuid ) : array
$uuid string the id in JCR format
Результат array associative array for the node (decoded from json with associative = true)

getNodePathForIdentifier() публичный Метод

Get the node path from a JCR uuid. This is mainly useful for cross-workspace functionality like clone or updateFrom.
См. также: getNodeByIdentifier
public getNodePathForIdentifier ( string $uuid, string $workspace = null ) : string
$uuid string the unique uuid to find the path of
$workspace string pass null to use the current workspace of this transport
Результат string Absolute path to the node (not the node itself!)

getNodeTypes() публичный Метод

If the transport does not support registering new node types, it can just return types from the hard coded definition at Jackalope\Transport\StandardNodeTypes
См. также: NodeTypeDefinition::fromArray
public getNodeTypes ( $nodeTypes = [] ) : array
Результат array with the definitions

getNodes() публичный Метод

This is an optimization over getNode to get many nodes in one call. If the transport implementation does not optimize, it can just loop over the paths and call getNode repeatedly. If a transport can do it, it should also implement NodeTypeFilterInterface. For prefetch, there are two mechanisms: As with getNode, the stdClass structure may be recursive. Additionally, the transport is allowed to return additional entries that where not requested in the returned array. Jackalope takes care of only returning nodes that where actually requested by the client and caching the rest.
public getNodes ( array $paths ) : array
$paths array Absolute paths to the nodes.
Результат array keys are the absolute paths, values is the node data as associative array (decoded from json with associative = true)

getNodesByIdentifier() публичный Метод

This is an optimization over getNodeByIdentifier to get many nodes in one call. If the transport implementation does not optimize, it can just loop over the uuids and call getNodeByIdentifier repeatedly.
public getNodesByIdentifier ( array $identifiers ) : array
$identifiers array list of uuid to retrieve
Результат array keys are the absolute paths, values is the node data as associative array (decoded from json with associative = true). they will have the identifier value set.

getProperty() публичный Метод

Same format as getNode with just one property. Again, for binary properties just returns the size and not the actual data.
public getProperty ( string $path ) : stdClass
$path string absolute path to the property to get
Результат stdClass a json struct with the property type and property value(s)

getReferences() публичный Метод

Returns the path of all accessible REFERENCE properties in the workspace that point to the node
public getReferences ( string $path, string $name = null ) : array
$path string absolute path to the node we need the references to
$name string name of referring REFERENCE properties to be returned; if null then all referring REFERENCEs are returned
Результат array

getRepositoryDescriptors() публичный Метод

This may be called before login or accessing any specific workspace. With this, you can get some information without being logged in. Must return at least the constants defined in \PHPCR\RepositoryInterface Doc about each constant is found there. Implementations may add their own constants. The transport has to make sure the correct boolean values are set for optional features. Jackalope will rely on the interface implementation, but client code could check the descriptors and be confused if you announce invalid capabilities here.
См. также: http://www.day.com/specs/jcr/2.0/24_Repository_Compliance.html#24.2%20Repository%20Descriptors
См. также: RepositoryInterface
public getRepositoryDescriptors ( ) : array
Результат array with name => value/array of value for the descriptors

getWeakReferences() публичный Метод

Returns the path of all accessible WEAKREFERENCE properties in the workspace that point to the node
public getWeakReferences ( string $path, string $name = null ) : array
$path string absolute path to the node we need the references to
$name string name of referring WEAKREFERENCE properties to be returned; if null then all referring WEAKREFERENCEs are returned
Результат array

login() публичный Метод

This can only be called once. To connect to another workspace or with another credential, use a fresh instance of transport. What implementation of credentials is supported is transport specific.
public login ( PHPCR\CredentialsInterface $credentials = null, string $workspaceName = null ) : string
$credentials PHPCR\CredentialsInterface the credentials to connect with the backend
$workspaceName string The workspace name to connect to. Null means to connect to the default workspace.
Результат string The workspace name that we connected to. This must be $workspaceName unless that was null, where it is the name of the default workspace.

logout() публичный Метод

This method is called on $session->logout Implementations can use it to close database connections and similar.
public logout ( )

setAutoLastModified() публичный Метод

If this is true, the transport has to make sure that on any node change that does not already include a change to the lastModified property, the jcr:lastModified property on nodes with the mixin is set to the current DateTime, and jcr:lastModifiedBy to the user id according to the credentials. Note: On read only stores, this is never used.
public setAutoLastModified ( boolean $autoLastModified )
$autoLastModified boolean

setFetchDepth() публичный Метод

Be aware the the actual Session->getNode call does not return all the children. This setting only tells the transport to preemptively fetch all the children from the backend.
public setFetchDepth ( integer $depth )
$depth integer The depth with which the nodes should be fetched.

setNodeTypeManager() публичный Метод

Pass the node type manager into the transport to be used for validation and such.
public setNodeTypeManager ( NodeTypeManager $nodeTypeManager )
$nodeTypeManager Jackalope\NodeType\NodeTypeManager