phpcr/src/PHPCR/NodeType/NodeTypeManagerInterface.php

Show: PublicProtectedPrivateinherited
    Table of Contents
    This file is part of the PHPCR API and was originally ported from the Java JCR API to PHP by Karsten Dambekalns for the FLOW3 project.

    Copyright 2008-2011 Karsten Dambekalns karsten@typo3.org

    Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0
    

    Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

    License
    Apache Software License 2.0  
    Link
    http://phpcr.github.com/  

    \PHPCR\NodeType\NodeTypeManagerInterface

    Package: Default
    Allows for the retrieval and (in implementations that support it) the registration of node types.

    Accessed via WorkspaceInterface::getNodeTypeManager().

    The \Traversable interface enables the implementation to be addressed with foreach. NodeTypeManager has to implement either \RecursiveIterator or \Iterator. The iterator is equivalent to getAllNodeTypes() returning a list of all node types. The iterator keys have no significant meaning.

    Parent(s)
    \Traversable
    Api
     

    Methods

    methodpubliccreateNodeDefinitionTemplate() : \PHPCR\NodeType\NodeDefinitionTemplateInterface

    Returns an empty NodeDefinitionTemplate which can then be used to create a child node definition and attached to a NodeTypeTemplate.

    Returns
    TypeDescription
    \PHPCR\NodeType\NodeDefinitionTemplateInterfaceA NodeDefinitionTemplate.
    Throws
    ExceptionDescription
    \PHPCR\UnsupportedRepositoryOperationExceptionif this implementation does not support node type registration.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpubliccreateNodeTypeTemplate(\PHPCR\NodeType\NodeTypeDefinitionInterface $ntd = null) : \PHPCR\NodeType\NodeTypeTemplateInterface

    Returns an empty NodeTypeTemplateInterface which can then be used to define a node type and passed to NodeTypeManagerInterface::registerNodeType().

    If $ntd is given: Returns a NodeTypeTemplateInterface holding the specified node type definition. This template can then be altered and passed to NodeTypeManagerInterface::registerNodeType().

    Parameters
    NameTypeDescription
    $ntd\PHPCR\NodeType\NodeTypeDefinitionInterface

    a NodeTypeDefinition.

    Returns
    TypeDescription
    \PHPCR\NodeType\NodeTypeTemplateInterfaceA NodeTypeTemplate.
    Throws
    ExceptionDescription
    \PHPCR\UnsupportedRepositoryOperationExceptionif this implementation does not support node type registration.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpubliccreatePropertyDefinitionTemplate() : \PHPCR\NodeType\PropertyDefinitionTemplateInterface

    Returns an empty PropertyDefinitionTemplateInterface which can then be used to create a property definition and attached to a NodeTypeTemplateInterface.

    Returns
    TypeDescription
    \PHPCR\NodeType\PropertyDefinitionTemplateInterfaceAn empty PropertyDefinitionTemplateInterface instance.
    Throws
    ExceptionDescription
    \PHPCR\UnsupportedRepositoryOperationExceptionif this implementation does not support node type registration.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicgetAllNodeTypes() : \Iterator

    Returns an iterator over all available node types (primary and mixin).

    Returns
    TypeDescription
    \Iteratorimplementing <b>SeekableIterator</b> and <b>Countable</b>. Keys are the node type names, values the corresponding NodeTypeInterface instances.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicgetMixinNodeTypes() : \Iterator

    Returns an iterator over all available mixin node types.

    If none are available, an empty iterator is returned.

    Returns
    TypeDescription
    \Iteratorimplementing <b>SeekableIterator</b> and <b>Countable</b>. Keys are the node type names, values the corresponding NodeTypeInterface instances.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicgetNodeType(string $nodeTypeName) : \PHPCR\NodeType\NodeTypeInterface

    Returns the named node type.

    Parameters
    NameTypeDescription
    $nodeTypeNamestring

    the name of an existing node type.

    Returns
    TypeDescription
    \PHPCR\NodeType\NodeTypeInterfaceA NodeType object.
    Throws
    ExceptionDescription
    \PHPCR\NodeType\NoSuchNodeTypeExceptionif no node type of the given name exists.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicgetPrimaryNodeTypes() : \Iterator

    Returns an iterator over all available primary node types.

    Returns
    TypeDescription
    \Iteratorimplementing <b>SeekableIterator</b> and <b>Countable</b>. Keys are the node type names, values the corresponding NodeTypeInterface instances.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublichasNodeType(string $name) : boolean

    Determines if the given node type is registered.

    Returns true if a node type with the specified name is registered. Returns false otherwise.

    Parameters
    NameTypeDescription
    $namestring

    The name of node type.

    Returns
    TypeDescription
    booleanTrue, if the node type identified by its name is registered, else false.
    Throws
    ExceptionDescription
    \PHPCR\RepositoryExceptionif an error occurs.
    Details
    Api
     
    methodpublicregisterNodeType(\PHPCR\NodeType\NodeTypeDefinitionInterface $ntd, boolean $allowUpdate) : \PHPCR\NodeType\NodeTypeInterface

    Registers a new node type or updates an existing node type using the specified definition and returns the resulting NodeTypeInterface object.

    Typically, the object passed to this method will be a NodeTypeTemplateInterface (a subclass of NodeTypeDefinitionInterface) acquired from NodeTypeManagerInterface::createNodeTypeTemplate() and then filled-in with definition information.

    Parameters
    NameTypeDescription
    $ntd\PHPCR\NodeType\NodeTypeDefinitionInterface

    a NodeTypeDefinitionInterface instance.

    $allowUpdateboolean

    whether to fail if node already exists or to update it.

    Returns
    TypeDescription
    \PHPCR\NodeType\NodeTypeInterfacethe registered node type.
    Throws
    ExceptionDescription
    \PHPCR\NodeType\InvalidNodeTypeDefinitionExceptionif the NodeTypeDefinitionInterface is invalid.
    \PHPCR\NodeType\NodeTypeExistsExceptionif allowUpdate is false and the NodeTypeDefinition specifies a node type name that is already registered.
    \PHPCR\UnsupportedRepositoryOperationExceptionif this implementation does not support node type registration.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicregisterNodeTypes(array $definitions, boolean $allowUpdate) : \Iterator

    Registers or updates the specified array of NodeTypeDefinition objects.

    This method is used to register or update a set of node types with mutual dependencies. Returns an iterator over the resulting NodeType objects. The effect of the method is "all or nothing"; if an error occurs, no node types are registered or updated.

    Parameters
    NameTypeDescription
    $definitionsarray

    an array of NodeTypeDefinitions.

    $allowUpdateboolean

    whether to fail if node already exists or to update it.

    Returns
    TypeDescription
    \Iteratorover the registered node types implementing <b>SeekableIterator</b> and <b>Countable</b>. Keys are the node type names, values the corresponding NodeTypeInterface instances.
    Throws
    ExceptionDescription
    \PHPCR\NodeType\InvalidNodeTypeDefinitionExceptionif a NodeTypeDefinitionInterface within the Collection is invalid or if the Collection contains an object of a type other than NodeTypeDefinitionInterface.
    \PHPCR\NodeType\NodeTypeExistsExceptionif allowUpdate is false and a NodeTypeDefinition within the Collection specifies a node type name that is already registered.
    \PHPCR\UnsupportedRepositoryOperationExceptionif this implementation does not support node type registration.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicregisterNodeTypesCnd(string $cnd, boolean $allowUpdate) : \Iterator

    Registers or updates the node type definitions as per the Compact Node Definition (CND) given by the supplied string.

    This method is used to register or update a set of node types with mutual dependencies. Returns an iterator over the resulting NodeType objects.

    The effect of the method is "all or nothing"; if an error occurs, no node types are registered or updated.

    A simple example is <'phpcr'='http://www.doctrine-project.org/projects/phpcr_odm'> [phpcr:managed] mixin - phpcr:class (string)

    For full documentation of the format, see http://jackrabbit.apache.org/node-type-notation.html

    PHPCR Note: Rather than doing mixed arguments we decided to name this method explicitly different, as we have no operator overloading in PHP.

    Parameters
    NameTypeDescription
    $cndstring

    containing the node type definitions in CND format

    $allowUpdateboolean

    whether existing node type definitions should be modified/updated.

    Returns
    TypeDescription
    \Iteratorover the registered node types implementing <b>SeekableIterator</b> and <b>Countable</b>. Keys are the node type names, values the corresponding NodeTypeInterface instances.
    Throws
    ExceptionDescription
    \PHPCR\NodeType\InvalidNodeTypeDefinitionExceptionif a NodeTypeDefinition within the CND is invalid.
    \PHPCR\NodeType\NodeTypeExistsExceptionif allowUpdate is false and a the NodeTypeDefinition within the CND string specifies a node type name that is already registered.
    \PHPCR\UnsupportedRepositoryOperationExceptionif this implementation does not support node type registration.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Since
    JCR 2.1  
    methodpublicunregisterNodeType(string $name) : void

    Unregisters the specified node type.

    Parameters
    NameTypeDescription
    $namestring

    The name of the node type to be removed from the registry.

    Throws
    ExceptionDescription
    \PHPCR\UnsupportedRepositoryOperationExceptionif this implementation does not support node type registration.
    \PHPCR\NodeType\NoSuchNodeTypeExceptionif no registered node type exists with the specified name.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    methodpublicunregisterNodeTypes(array $names) : void

    Unregisters the specified set of node types.

    Used to unregister a set of node types with mutual dependencies.

    Parameters
    NameTypeDescription
    $namesarray

    List of node type names to be removed from the registry.

    Throws
    ExceptionDescription
    \PHPCR\UnsupportedRepositoryOperationExceptionif this implementation does not support node type registration.
    \PHPCR\NodeType\NoSuchNodeTypeExceptionif one of the names listed is not a registered node type.
    \PHPCR\RepositoryExceptionif another error occurs.
    Details
    Api
     
    Documentation was generated by phpDocumentor 2.0.0a12.