class DocumentClassMapper implements DocumentClassMapperInterface (View source)

Stores the class mapping in the phpcr:class attribute.

If no class is found, use 'Doctrine\ODM\PHPCR\Document\Generic'

Methods

string
getClassName(DocumentManagerInterface $dm, NodeInterface $node, string $className = null)

Determine the class name from a given node.

writeMetadata(DocumentManagerInterface $dm, NodeInterface $node, string $className)

Write any relevant meta data into the node to be able to map back to a class name later.

validateClassName(DocumentManagerInterface $dm, object $document, string $className)

Check if the document is instance of the specified $className and throw exception if not.

Details

string getClassName(DocumentManagerInterface $dm, NodeInterface $node, string $className = null)

Determine the class name from a given node.

Parameters

DocumentManagerInterface $dm
NodeInterface $node
string $className explicit class to use. If set, this class or a subclass of it has to be used. If this is not possible, an InvalidArgumentException has to be thrown.

Return Value

string $className if not null, the class configured for this node if defined and the Generic document if no better class can be found

Exceptions

ClassMismatchException if $node represents a class that is not a descendant of $className.

writeMetadata(DocumentManagerInterface $dm, NodeInterface $node, string $className)

Write any relevant meta data into the node to be able to map back to a class name later.

Parameters

DocumentManagerInterface $dm
NodeInterface $node
string $className

validateClassName(DocumentManagerInterface $dm, object $document, string $className)

Check if the document is instance of the specified $className and throw exception if not.

Parameters

DocumentManagerInterface $dm
object $document
string $className

Exceptions

ClassMismatchException if document is not of type $className