PHP Class Jackalope\NodeType\NodeTypeManager

In Jackalope, we try to do lazy fetching of node types to reduce overhead. Jackalope supports registering node types, and when using the jackrabbit for transport, there is an additional method registerNodeTypesCnd for the jackrabbit specific textual node type specification
Inheritance: implements IteratorAggregat\IteratorAggregate, implements PHPCR\NodeType\NodeTypeManagerInterface
Afficher le fichier Open project: jackalope/jackalope Class Usage Examples

Protected Properties

Свойство Type Description
$factory Jackalope\FactoryInterface The factory to instantiate objects.
$fetchedAllFromBackend boolean Methods like hasNodeType() need to fetch all node types. Others like getNodeType() do not need all, but just the requested one. Unless we need all, we only load specific ones and cache them.
$mixinTypes array Cache of already fetched mixin node type instances.
$namespaceRegistry PHPCR\NamespaceRegistryInterface
$nodeTree array Array of arrays with the super type as key and its sub types as values.
$objectManager Jackalope\ObjectManager
$primaryTypes array Cache of already fetched primary node type instances.

Méthodes publiques

Méthode Description
__construct ( Jackalope\FactoryInterface $factory, ObjectManager $objectManager, PHPCR\NamespaceRegistryInterface $namespaceRegistry ) Create the node type manager for a session.
createNodeDefinitionTemplate ( ) {@inheritDoc}
createNodeTypeTemplate ( $ntd = null ) {@inheritDoc}
createPropertyDefinitionTemplate ( ) {@inheritDoc}
getAllNodeTypes ( ) {@inheritDoc}
getDeclaredSubtypes ( string $nodeTypeName ) : array Helper method for node types: Returns the declared subtypes of a given nodename.
getIterator ( ) : Iterator Provide Traversable interface: redirect to getAllNodeTypes
getMixinNodeTypes ( ) {@inheritDoc}
getNodeType ( $nodeTypeName ) {@inheritDoc}
getPrimaryNodeTypes ( ) {@inheritDoc}
getSubtypes ( string $nodeTypeName ) : array Helper method for NodeType: Returns all sub types of a node and their sub types.
hasNodeType ( $name ) {@inheritDoc}
registerNodeType ( PHPCR\NodeType\NodeTypeDefinitionInterface $ntd, $allowUpdate ) {@inheritDoc}
registerNodeTypes ( array $definitions, $allowUpdate ) {@inheritDoc}
registerNodeTypesCnd ( $cnd, $allowUpdate ) {@inheritDoc}
unregisterNodeType ( $name ) {@inheritDoc}
unregisterNodeTypes ( array $names ) {@inheritDoc}

Méthodes protégées

Méthode Description
addNodeType ( PHPCR\NodeType\NodeTypeInterface $nodeType ) Stores the node type in our internal structures (flat && tree)
createNodeType ( PHPCR\NodeType\NodeTypeDefinitionInterface $ntd, boolean $allowUpdate ) : NodeType Internally create a node type object
fetchNodeTypes ( string $name = null ) Fetch a node type from backend.

Private Methods

Méthode Description
addToNodeTree ( PHPCR\NodeType\NodeTypeInterface $nodetype ) Adds the declared super types of a node type to the tree to be able to fetch the sub types of those super types later on.

Method Details

__construct() public méthode

There may be only one instance per session
public __construct ( Jackalope\FactoryInterface $factory, ObjectManager $objectManager, PHPCR\NamespaceRegistryInterface $namespaceRegistry )
$factory Jackalope\FactoryInterface
$objectManager Jackalope\ObjectManager
$namespaceRegistry PHPCR\NamespaceRegistryInterface

addNodeType() protected méthode

Stores the node type in our internal structures (flat && tree)
protected addNodeType ( PHPCR\NodeType\NodeTypeInterface $nodeType )
$nodeType PHPCR\NodeType\NodeTypeInterface The nodetype to add

createNodeDefinitionTemplate() public méthode

{@inheritDoc}

createNodeType() protected méthode

Internally create a node type object
protected createNodeType ( PHPCR\NodeType\NodeTypeDefinitionInterface $ntd, boolean $allowUpdate ) : NodeType
$ntd PHPCR\NodeType\NodeTypeDefinitionInterface
$allowUpdate boolean whether updating the definition is to be allowed or not
Résultat NodeType the new node type

createNodeTypeTemplate() public méthode

{@inheritDoc}
public createNodeTypeTemplate ( $ntd = null )

createPropertyDefinitionTemplate() public méthode

{@inheritDoc}

fetchNodeTypes() protected méthode

Without a filter parameter, this will fetch all node types from the backend. It is no problem to call this method with null as name, it will remember once it fetched all node types and do nothing after that. On fetch all, already cached node types are kept.
protected fetchNodeTypes ( string $name = null )
$name string type name to fetch. defaults to null which will fetch all nodes.

getAllNodeTypes() public méthode

{@inheritDoc}
public getAllNodeTypes ( )

getDeclaredSubtypes() public méthode

Helper method for node types: Returns the declared subtypes of a given nodename.
See also: NodeType::getDeclaredSubtypes
public getDeclaredSubtypes ( string $nodeTypeName ) : array
$nodeTypeName string
Résultat array with the names of the subnode types pointing to the node type instances

getIterator() public méthode

Provide Traversable interface: redirect to getAllNodeTypes
public getIterator ( ) : Iterator
Résultat Iterator over all node types

getMixinNodeTypes() public méthode

{@inheritDoc}
public getMixinNodeTypes ( )

getNodeType() public méthode

{@inheritDoc}
public getNodeType ( $nodeTypeName )

getPrimaryNodeTypes() public méthode

{@inheritDoc}
public getPrimaryNodeTypes ( )

getSubtypes() public méthode

Helper method for NodeType: Returns all sub types of a node and their sub types.
See also: NodeType::getSubtypes
public getSubtypes ( string $nodeTypeName ) : array
$nodeTypeName string
Résultat array with the names of the subnode types pointing to the node type instances

hasNodeType() public méthode

{@inheritDoc}
public hasNodeType ( $name )

registerNodeType() public méthode

{@inheritDoc}
public registerNodeType ( PHPCR\NodeType\NodeTypeDefinitionInterface $ntd, $allowUpdate )
$ntd PHPCR\NodeType\NodeTypeDefinitionInterface

registerNodeTypes() public méthode

{@inheritDoc}
public registerNodeTypes ( array $definitions, $allowUpdate )
$definitions array

registerNodeTypesCnd() public méthode

{@inheritDoc}
public registerNodeTypesCnd ( $cnd, $allowUpdate )

unregisterNodeType() public méthode

{@inheritDoc}
public unregisterNodeType ( $name )

unregisterNodeTypes() public méthode

{@inheritDoc}
public unregisterNodeTypes ( array $names )
$names array

Property Details

$factory protected_oe property

The factory to instantiate objects.
protected FactoryInterface,Jackalope $factory
Résultat Jackalope\FactoryInterface

$fetchedAllFromBackend protected_oe property

Methods like hasNodeType() need to fetch all node types. Others like getNodeType() do not need all, but just the requested one. Unless we need all, we only load specific ones and cache them.
protected bool $fetchedAllFromBackend
Résultat boolean

$mixinTypes protected_oe property

Cache of already fetched mixin node type instances.
protected array $mixinTypes
Résultat array

$namespaceRegistry protected_oe property

protected NamespaceRegistryInterface,PHPCR $namespaceRegistry
Résultat PHPCR\NamespaceRegistryInterface

$nodeTree protected_oe property

Array of arrays with the super type as key and its sub types as values.
protected array $nodeTree
Résultat array

$objectManager protected_oe property

protected ObjectManager,Jackalope $objectManager
Résultat Jackalope\ObjectManager

$primaryTypes protected_oe property

Cache of already fetched primary node type instances.
protected array $primaryTypes
Résultat array