class ReflectionDriver implements MappingDriver (View source)

A mapping driver that use Reflection and DocComments to generate class metadata

This driver is compatible with Doctrine ORM ClassMetadata with some missing feature support.

Constants

PUBLIC_PROPERTY_AUTO_MAPPING

Map all public properties as fields

LIFECYCLE_METHOD_AUTO_MAPPING

Map method with a name corresponding to a lifecycle event as a lifecycle callback

EMBED_PARENT

Embed parent fields and associations

ASSOCIATION_TARGET_SHORT_NAME

When possible, keep short class names for association target class.

This flag is mostly used for compatibility with other Doctrine drivers.

TAG_ENTITY

TAG_FIELD

TAG_ID

TAG_MANY_TO_MANY

TAG_MANY_TO_ONE

TAG_ONE_TO_MANY

TAG_ONE_TO_ONE

TAG_OPTIONS

Field mapping options.

TAG_EXTRA

Extra field metadata that should be used for other purpose than object mapping (ex.

UI attributes).

MAPPING_FIELDS

MAPPING_ASSOCIATIONS

Properties

$docBlockTagPrefix The PHPDoc tag prefix used in PHP source files

Methods

__construct(string[] $paths, integer $flags = 0)

No description

getInflector()

No description

setInflector(Inflector $inflector)

No description

getAllClassNames()

No description

isTransient($className)

No description

loadMetadataForClass($className, $metadata)

No description

postprocessAssociationMappings($associations, $context = array())

No description

postprocessAssociationMapping($mapping, $mapFunction, $context = array())

No description

getIdentifierMapping($className, $metadata)

No description

cacheMetadataForClass($className, $metadata)

No description

getTableNameFromClassName($className)

No description

getQualifiedClassName($className, $namespace)

No description

static 
parseIdGeneratorType($v, ClassMetadata $metadata)

No description

setEventConstantClass(string|ReflectionClass $class)

Set the class containing the list of available events

mapFields(ClassMetadata $metadata, $mappings = [])

No description

mapAssociations(ClassMetadata $metadata, $mappings)

No description

processProperties($visited, ClassMetadata $metadata, ReflectionFile $file, ReflectionClass $reflectionClass, $defaultInstance)

No description

static 
stringToBoolean($v)

No description

static 
invertBoolean($v)

No description

static 
getClassMetadataClassConstant($metadataOrmetadataClassName, $prefix, $suffix)

No description

static void|mixed
invokeClassMetadataMethod(ClassMetadata $metadata, string $method, ... ...$arguments)

Invoke class metadata instance method only if it exists.

parseParameters($output, $text, ClassMetadata $metadata, $parametersProperties)

No description

getTargetEntityFromVariableDeclaration($variable, $file, $property, $associationTagName)

No description

static 
setSpecialGenerator(mixed $type, ClassMetadata $metadata, array $mapping)

Call generator type-specific metadata methods.

setAutomaticMapping($mapping, ReflectionFile $file, ReflectionProperty $property, ReflectionDocComment $block, $defaultInstance = null)

No description

retrievePropertyDefaultValue($value, ReflectionProperty $property, $defaultInstance = null)

No description

setDefaultAutomaticMapping($mapping, ReflectionFile $file, ReflectionProperty $property, $defaultInstance = null)

No description

setTypeAutomaticMapping(array $mapping, ReflectionFile $file, ReflectionProperty $property, array $types)

No description

resolveClassname($className, ReflectionFile $file, $namespace)

No description

isInPaths($filename)

No description

getTag(ReflectionDocComment $block, $name, $index = 0)

No description

getTags(ReflectionDocComment $block, $name)

No description

hasTag(ReflectionDocComment $block, $name)

No description

getEventParameters()

No description

static 
static 
static 
getIdTagParametersDescriptor()

No description

static 
static 
static 
static 
static 
static 

Details

__construct(string[] $paths, integer $flags = 0)

Parameters

string[] $paths Class paths
integer $flags Driver flags

getInflector()

setInflector(Inflector $inflector)

Parameters

Inflector $inflector

getAllClassNames()

isTransient($className)

Parameters

$className

loadMetadataForClass($className, $metadata)

Parameters

$className
$metadata

protected postprocessAssociationMappings($associations, $context = array())

Parameters

$associations
$context

protected postprocessAssociationMapping($mapping, $mapFunction, $context = array())

Parameters

$mapping
$mapFunction
$context

protected getIdentifierMapping($className, $metadata)

Parameters

$className
$metadata

protected cacheMetadataForClass($className, $metadata)

Parameters

$className
$metadata

protected getTableNameFromClassName($className)

Parameters

$className

protected getQualifiedClassName($className, $namespace)

Parameters

$className
$namespace

protected ReflectionClass getEventConstantsClass()

Return Value

ReflectionClass

static protected parseIdGeneratorType($v, ClassMetadata $metadata)

Parameters

$v
ClassMetadata $metadata

protected setEventConstantClass(string|ReflectionClass $class)

Set the class containing the list of available events

Parameters

string|ReflectionClass $class

protected mapFields(ClassMetadata $metadata, $mappings = [])

Parameters

ClassMetadata $metadata
$mappings

protected mapAssociations(ClassMetadata $metadata, $mappings)

Parameters

ClassMetadata $metadata
$mappings

protected processProperties($visited, ClassMetadata $metadata, ReflectionFile $file, ReflectionClass $reflectionClass, $defaultInstance)

Parameters

$visited
ClassMetadata $metadata
ReflectionFile $file
ReflectionClass $reflectionClass
$defaultInstance

static stringToBoolean($v)

Parameters

$v

static invertBoolean($v)

Parameters

$v

static getClassMetadataClassConstant($metadataOrmetadataClassName, $prefix, $suffix)

Parameters

$metadataOrmetadataClassName
$prefix
$suffix

static void|mixed invokeClassMetadataMethod(ClassMetadata $metadata, string $method, ... ...$arguments)

Invoke class metadata instance method only if it exists.

Parameters

ClassMetadata $metadata Class metadata
string $method Class metadata method name
... ...$arguments Method arguments

Return Value

void|mixed

protected parseParameters($output, $text, ClassMetadata $metadata, $parametersProperties)

Parameters

$output
$text
ClassMetadata $metadata
$parametersProperties

protected getTargetEntityFromVariableDeclaration($variable, $file, $property, $associationTagName)

Parameters

$variable
$file
$property
$associationTagName

static protected setSpecialGenerator(mixed $type, ClassMetadata $metadata, array $mapping)

Call generator type-specific metadata methods.

Mostly for Doctrine ORM ClassMetadata.

Parameters

mixed $type Generator type
ClassMetadata $metadata Class metadata
array $mapping Current mapping

protected setAutomaticMapping($mapping, ReflectionFile $file, ReflectionProperty $property, ReflectionDocComment $block, $defaultInstance = null)

Parameters

$mapping
ReflectionFile $file
ReflectionProperty $property
ReflectionDocComment $block
$defaultInstance

protected retrievePropertyDefaultValue($value, ReflectionProperty $property, $defaultInstance = null)

Parameters

$value
ReflectionProperty $property
$defaultInstance

protected setDefaultAutomaticMapping($mapping, ReflectionFile $file, ReflectionProperty $property, $defaultInstance = null)

Parameters

$mapping
ReflectionFile $file
ReflectionProperty $property
$defaultInstance

protected setTypeAutomaticMapping(array $mapping, ReflectionFile $file, ReflectionProperty $property, array $types)

Parameters

array $mapping Property mapping
ReflectionFile $file Class file
ReflectionProperty $property Class property
array $types List of type names from @var tag

protected resolveClassname($className, ReflectionFile $file, $namespace)

Parameters

$className
ReflectionFile $file
$namespace

protected isInPaths($filename)

Parameters

$filename

protected getTag(ReflectionDocComment $block, $name, $index = 0)

Parameters

ReflectionDocComment $block
$name
$index

protected getTags(ReflectionDocComment $block, $name)

Parameters

ReflectionDocComment $block
$name

protected hasTag(ReflectionDocComment $block, $name)

Parameters

ReflectionDocComment $block
$name

protected getEventParameters()

static getEntityTagParametersDescriptor()

static getPropertyTagParametersDescriptor()

static getIdTagParametersDescriptor()

static getFieldTagParametersDescriptor()

static getAssociationTagParametersDescriptor()

static getManyToManyTagParametersDescriptor()

static getManyToOneTagParametersDescriptor()

static getOneToManyTagParametersDescriptor()

static getOneToOneTagParametersDescriptor()