abstract class AnnotationDriver implements MappingDriver (View source)

The AnnotationDriver reads the mapping metadata from docblock annotations.

Properties

protected Reader $reader The annotation reader.
protected array $paths The paths where to look for mapping files.
protected array $excludePaths The paths excluded from path where to look for mapping files.
protected string $fileExtension The file extension of mapping documents.
protected array|null $classNames Cache for AnnotationDriver#getAllClassNames().
protected array $entityAnnotationClasses Name of the entity annotations as keys.

Methods

__construct(Reader $reader, string|array|null $paths = null)

Initializes a new AnnotationDriver that uses the given AnnotationReader for reading docblock annotations.

void
addPaths(array $paths)

Appends lookup paths to metadata driver.

array
getPaths()

Retrieves the defined metadata lookup paths.

addExcludePaths(array $paths)

Append exclude lookup paths to metadata driver.

array
getExcludePaths()

Retrieve the defined metadata lookup exclude paths.

Reader
getReader()

Retrieve the current annotation reader

string
getFileExtension()

Gets the file extension used to look for mapping files under.

void
setFileExtension(string $fileExtension)

Sets the file extension used to look for mapping files under.

boolean
isTransient(string $className)

Returns whether the class with the specified name is transient. Only non-transient classes, that is entities and mapped superclasses, should have their metadata loaded.

array
getAllClassNames()

Gets the names of all mapped classes known to this driver.

Details

__construct(Reader $reader, string|array|null $paths = null)

Initializes a new AnnotationDriver that uses the given AnnotationReader for reading docblock annotations.

Parameters

Reader $reader The annotation Reader to use, duck-typed.
string|array|null $paths One or multiple paths where mapping classes can be found.

void addPaths(array $paths)

Appends lookup paths to metadata driver.

Parameters

array $paths

Return Value

void

array getPaths()

Retrieves the defined metadata lookup paths.

Return Value

array

addExcludePaths(array $paths)

Append exclude lookup paths to metadata driver.

Parameters

array $paths

array getExcludePaths()

Retrieve the defined metadata lookup exclude paths.

Return Value

array

Reader getReader()

Retrieve the current annotation reader

Return Value

Reader

string getFileExtension()

Gets the file extension used to look for mapping files under.

Return Value

string

void setFileExtension(string $fileExtension)

Sets the file extension used to look for mapping files under.

Parameters

string $fileExtension The file extension to set.

Return Value

void

boolean isTransient(string $className)

Returns whether the class with the specified name is transient. Only non-transient classes, that is entities and mapped superclasses, should have their metadata loaded.

A class is non-transient if it is annotated with an annotation from the {see AnnotationDriver::entityAnnotationClasses}.

Parameters

string $className

Return Value

boolean

array getAllClassNames()

Gets the names of all mapped classes known to this driver.

Return Value

array The names of all mapped classes known to this driver.