FlowAnnotationDriver
class FlowAnnotationDriver implements MappingDriver, PointcutFilterInterface (View source)
This driver reads the mapping metadata from docblock annotations.
It gives precedence to Doctrine annotations but fills gaps from other info if possible:
- Entity.repositoryClass is set to the repository found in the class schema
- Table.name is set to a sane value
- Column.type is set to property type
- *.targetEntity is set to property type
If a property is not marked as an association the mapping type is set to "object" for objects.
Constants
MAPPING_REGULAR |
|
MAPPING_MM_REGULAR |
|
Properties
protected ReflectionService | $reflectionService | ||
protected AnnotationReader | $reader | ||
protected EntityManagerInterface | $entityManager | ||
protected array | $classNames | ||
protected int | $tableNameLengthLimit |
Methods
Initializes a new AnnotationDriver that uses the given AnnotationReader for reading docblock annotations.
No description
Fetch a class schema for the given class, if possible.
Check for $className being an aggregate root.
Check for $className being a value object.
Loads the metadata for the specified class into the provided container.
Given a class name a table name is returned. That name should be reasonably unique.
Given a class name returns a value to be used as a discriminator type value.
Truncate an identifier if needed and append a hash to ensure uniqueness.
Given a class and property name a table name is returned. That name should be reasonably unique.
Build a name for a column in a jointable.
Check if the referenced column name is set (and valid) and if not make sure it is initialized properly.
Evaluate the property annotations and amend the metadata accordingly.
Evaluate JoinTable annotations and fill missing bits as needed.
Check for and build JoinColummn/JoinColumns annotations.
Evaluate the association overrides annotations and amend the metadata accordingly.
Evaluate the EntityListeners annotation and amend the metadata accordingly.
Evaluate the lifecycle annotations and amend the metadata accordingly.
Returns an array of callbacks for lifecycle annotations on the given method.
Derive maximum identifier length from doctrine DBAL
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.
Returns the names of all mapped (non-transient) classes known to this driver.
Parse the given JoinColumn into an array
Parse the given Column into an array
Returns the classname after stripping a potentially present Compiler::ORIGINAL_CLASSNAME_SUFFIX.
Checks if the specified class has a property annotated with Id
Returns true if this filter holds runtime evaluations for a previously matched pointcut
Returns runtime evaluations for a previously matched pointcut
This method is used to optimize the matching process.
Details
__construct()
Initializes a new AnnotationDriver that uses the given AnnotationReader for reading docblock annotations.
void
injectReflectionService(ReflectionService $reflectionService)
No description
void
setEntityManager(EntityManagerInterface $entityManager)
No description
protected ClassSchema
getClassSchema(string $className)
Fetch a class schema for the given class, if possible.
protected bool
isAggregateRoot(string $className, string $propertySourceHint)
Check for $className being an aggregate root.
protected bool
isValueObject(string $className, string $propertySourceHint)
Check for $className being a value object.
void
loadMetadataForClass(string $className, ClassMetadata $metadata)
Loads the metadata for the specified class into the provided container.
string
inferTableNameFromClassName(string $className, int $lengthLimit = null)
Given a class name a table name is returned. That name should be reasonably unique.
static string
inferDiscriminatorTypeFromClassName(string $className)
Given a class name returns a value to be used as a discriminator type value.
protected string
truncateIdentifier(string $identifier, int $lengthLimit = null, string $hashSource = null)
Truncate an identifier if needed and append a hash to ensure uniqueness.
protected string
inferJoinTableNameFromClassAndPropertyName(string $className, string $propertyName)
Given a class and property name a table name is returned. That name should be reasonably unique.
protected string
buildJoinTableColumnName(string $className)
Build a name for a column in a jointable.
protected array
buildJoinColumnsIfNeeded(array $joinColumns, array $mapping, ReflectionProperty $property, int $direction = self::MAPPING_REGULAR)
Check if the referenced column name is set (and valid) and if not make sure it is initialized properly.
protected void
evaluatePropertyAnnotations(ClassMetadataInfo $metadata)
Evaluate the property annotations and amend the metadata accordingly.
protected array
evaluateJoinTableAnnotation(JoinTable $joinTableAnnotation, ReflectionProperty $property, string $className, array $mapping)
Evaluate JoinTable annotations and fill missing bits as needed.
protected array
evaluateJoinColumnAnnotations(ReflectionProperty $property)
Check for and build JoinColummn/JoinColumns annotations.
If no annotations are found, a default is returned.
protected void
evaluateOverridesAnnotations(array $classAnnotations, ClassMetadataInfo $metadata)
Evaluate the association overrides annotations and amend the metadata accordingly.
protected void
evaluateEntityListenersAnnotation(ReflectionClass $class, ClassMetadata $metadata, array $classAnnotations)
Evaluate the EntityListeners annotation and amend the metadata accordingly.
protected void
evaluateLifeCycleAnnotations(ReflectionClass $class, ClassMetadataInfo $metadata)
Evaluate the lifecycle annotations and amend the metadata accordingly.
protected array
getMethodCallbacks(ReflectionMethod $method)
Returns an array of callbacks for lifecycle annotations on the given method.
protected int
getMaxIdentifierLength()
Derive maximum identifier length from doctrine DBAL
bool
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()
Returns the names of all mapped (non-transient) classes known to this driver.
protected array
joinColumnToArray(JoinColumn $joinColumnAnnotation, string $propertyName = null)
Parse the given JoinColumn into an array
protected array
addColumnToMappingArray(Column $columnAnnotation, array $mapping = [], string $fieldName = null)
Parse the given Column into an array
protected string
getUnproxiedClassName(string $className)
Returns the classname after stripping a potentially present Compiler::ORIGINAL_CLASSNAME_SUFFIX.
bool
matches(string $className, string $methodName, string $methodDeclaringClassName, mixed $pointcutQueryIdentifier)
Checks if the specified class has a property annotated with Id
bool
hasRuntimeEvaluationsDefinition()
Returns true if this filter holds runtime evaluations for a previously matched pointcut
array
getRuntimeEvaluationsDefinition()
Returns runtime evaluations for a previously matched pointcut
ClassNameIndex
reduceTargetClassNames(ClassNameIndex $classNameIndex)
This method is used to optimize the matching process.