Doctrine\ORM\Mapping\ClassMetadataInfo
A <tt>ClassMetadata</tt> instance holds all the object-relational mapping metadata of an entity and it's associations.
Once populated, ClassMetadata instances are usually cached in a serialized form.
<b>IMPORTANT NOTE:</b>
The fields of this class are only public for 2 reasons:
1) To allow fast READ access.
2) To drastically reduce the size of a serialized instance (private/protected members
get the whole class name, namespace inclusive, prepended to every property in
the serialized representation).
- Author: Roman Borschel <roman@code-factory.org>
Synopsis
class ClassMetadataInfo
implements
ClassMetadata
{
- // constants
- const INHERITANCE_TYPE_NONE = 1;
- const INHERITANCE_TYPE_JOINED = 2;
- const INHERITANCE_TYPE_SINGLE_TABLE = 3;
- const INHERITANCE_TYPE_TABLE_PER_CLASS = 4;
- const GENERATOR_TYPE_AUTO = 1;
- const GENERATOR_TYPE_SEQUENCE = 2;
- const GENERATOR_TYPE_TABLE = 3;
- const GENERATOR_TYPE_IDENTITY = 4;
- const GENERATOR_TYPE_NONE = 5;
- const GENERATOR_TYPE_UUID = 6;
- const GENERATOR_TYPE_CUSTOM = 7;
- const CHANGETRACKING_DEFERRED_IMPLICIT = 1;
- const CHANGETRACKING_DEFERRED_EXPLICIT = 2;
- const CHANGETRACKING_NOTIFY = 3;
- const FETCH_LAZY = 2;
- const FETCH_EAGER = 3;
- const FETCH_EXTRA_LAZY = 4;
- const ONE_TO_ONE = 1;
- const MANY_TO_ONE = 2;
- const ONE_TO_MANY = 4;
- const MANY_TO_MANY = 8;
- const TO_ONE = 3;
- const TO_MANY = 12;
- // members
- public $name;
- public string $namespace;
- public string $rootEntityName;
- public array $customGeneratorDefinition;
- public string $customRepositoryClassName;
- public boolean $isMappedSuperclass;
- public array $parentClasses;
- public array $subClasses;
- public array $namedQueries;
- public array $namedNativeQueries;
- public array $sqlResultSetMappings;
- public array $identifier;
- public integer $inheritanceType;
- public string $generatorType;
- public array $fieldMappings;
- public array $fieldNames;
- public array $columnNames;
- public mixed $discriminatorValue;
- public array $discriminatorMap;
- public array $discriminatorColumn;
- public array $table;
- public array $lifecycleCallbacks;
- public array $associationMappings;
- public boolean $isIdentifierComposite;
- public boolean $containsForeignIdentifier;
- public AbstractIdGenerator $idGenerator;
- public array $sequenceGeneratorDefinition;
- public array $tableGeneratorDefinition;
- public integer $changeTrackingPolicy;
- public boolean $isVersioned;
- public mixed $versionField;
- public ReflectionClass $reflClass;
- public bool $isReadOnly;
- protected NamingStrategy $namingStrategy;
- public array $reflFields;
- private $_prototype;
- // methods
- public void __construct()
- public array getReflectionProperties()
- public ReflectionProperty getReflectionProperty()
- public ReflectionProperty getSingleIdReflectionProperty()
- public array getIdentifierValues()
- public void setIdentifierValues()
- public void setFieldValue()
- public void getFieldValue()
- public string __toString()
- public array __sleep()
- public newInstance()
- public void wakeupReflection()
- public void initializeReflection()
- public void validateIdentifier()
- public void validateAssocations()
- public void validateLifecycleCallbacks()
- public void getReflectionClass()
- public void setChangeTrackingPolicy()
- public boolean isChangeTrackingDeferredExplicit()
- public boolean isChangeTrackingDeferredImplicit()
- public boolean isChangeTrackingNotify()
- public boolean isIdentifier()
- public boolean isUniqueField()
- public boolean isNullable()
- public string getColumnName()
- public array getFieldMapping()
- public array getAssociationMapping()
- public array getAssociationMappings()
- public string getFieldName()
- public string getNamedQuery()
- public array getNamedQueries()
- public array getNamedNativeQuery()
- public array getNamedNativeQueries()
- public array getSqlResultSetMapping()
- public array getSqlResultSetMappings()
- protected array _validateAndCompleteFieldMapping()
- protected array _validateAndCompleteAssociationMapping()
- protected array _validateAndCompleteOneToOneMapping()
- protected array _validateAndCompleteOneToManyMapping()
- protected void _validateAndCompleteManyToManyMapping()
- public void getIdentifierFieldNames()
- public string getSingleIdentifierFieldName()
- public string getSingleIdentifierColumnName()
- public void setIdentifier()
- public array|string getIdentifier()
- public void hasField()
- public array getColumnNames()
- public array getIdentifierColumnNames()
- public void setIdGeneratorType()
- public boolean usesIdGenerator()
- public boolean isInheritanceTypeNone()
- public boolean isInheritanceTypeJoined()
- public boolean isInheritanceTypeSingleTable()
- public boolean isInheritanceTypeTablePerClass()
- public boolean isIdGeneratorIdentity()
- public boolean isIdGeneratorSequence()
- public boolean isIdGeneratorTable()
- public boolean isIdentifierNatural()
- public boolean isIdentifierUuid()
- public Type|string getTypeOfField()
- public Type getTypeOfColumn()
- public string getTableName()
- public string getTemporaryIdTableName()
- public void setSubclasses()
- public void setParentClasses()
- public void setInheritanceType()
- public void setAssociationOverride()
- public void setAttributeOverride()
- public bool isInheritedField()
- public bool isRootEntity()
- public boolean isInheritedAssociation()
- public void setTableName()
- public void setPrimaryTable()
- private boolean _isInheritanceType()
- public void mapField()
- public void addInheritedAssociationMapping()
- public void addInheritedFieldMapping()
- public void addNamedQuery()
- public void addNamedNativeQuery()
- public void addSqlResultSetMapping()
- public void mapOneToOne()
- public void mapOneToMany()
- public void mapManyToOne()
- public void mapManyToMany()
- protected void _storeAssociationMapping()
- public void setCustomRepositoryClass()
- public void invokeLifecycleCallbacks()
- public boolean hasLifecycleCallbacks()
- public array getLifecycleCallbacks()
- public void addLifecycleCallback()
- public void setLifecycleCallbacks()
- public void setDiscriminatorColumn()
- public void setDiscriminatorMap()
- public void addDiscriminatorMapClass()
- public boolean hasNamedQuery()
- public boolean hasNamedNativeQuery()
- public boolean hasSqlResultSetMapping()
- public void hasAssociation()
- public void isSingleValuedAssociation()
- public void isCollectionValuedAssociation()
- public bool isAssociationWithSingleJoinColumn()
- public string getSingleAssociationJoinColumnName()
- public string getSingleAssociationReferencedJoinColumnName()
- public string getFieldForColumn()
- public void setIdGenerator()
- public void setCustomGeneratorDefinition()
- public void setSequenceGeneratorDefinition()
- public void setVersionMapping()
- public void setVersioned()
- public void setVersionField()
- public void markReadOnly()
- public void getFieldNames()
- public void getAssociationNames()
- public void getAssociationTargetClass()
- public void getName()
- public array getQuotedIdentifierColumnNames()
- public string getQuotedColumnName()
- public string getQuotedTableName()
- public string getQuotedJoinTableName()
- public void isAssociationInverseSide()
- public void getAssociationMappedByTargetField()
- public array getAssociationsByTargetClass()
Hierarchy
Extended by
Implements
Tasks
Line | Task |
---|---|
+ | Not really needed. Usage could be localized. |
+ | Merge with tableGeneratorDefinition into generic generatorDefinition |
+ | We could get rid of this array by just using $fieldMappings[$fieldName]['columnName']. |
+ | Remove! |
+ | Merge with tableGeneratorDefinition into generic generatorDefinition |
+ | Merge with tableGeneratorDefinition into generic generatorDefinition |
686+ | Rename to assignIdentifier() |
722+ | Construct meaningful string representation. |
Constants
Name | Value |
---|---|
INHERITANCE_TYPE_NONE | 1 |
INHERITANCE_TYPE_JOINED | 2 |
INHERITANCE_TYPE_SINGLE_TABLE | 3 |
INHERITANCE_TYPE_TABLE_PER_CLASS | 4 |
GENERATOR_TYPE_AUTO | 1 |
GENERATOR_TYPE_SEQUENCE | 2 |
GENERATOR_TYPE_TABLE | 3 |
GENERATOR_TYPE_IDENTITY | 4 |
GENERATOR_TYPE_NONE | 5 |
GENERATOR_TYPE_UUID | 6 |
GENERATOR_TYPE_CUSTOM | 7 |
CHANGETRACKING_DEFERRED_IMPLICIT | 1 |
CHANGETRACKING_DEFERRED_EXPLICIT | 2 |
CHANGETRACKING_NOTIFY | 3 |
FETCH_LAZY | 2 |
FETCH_EAGER | 3 |
FETCH_EXTRA_LAZY | 4 |
ONE_TO_ONE | 1 |
MANY_TO_ONE | 2 |
ONE_TO_MANY | 4 |
MANY_TO_MANY | 8 |
TO_ONE | 3 |
TO_MANY | 12 |
Members
private
protected
- $namingStrategy
—
\Doctrine\ORM\Mapping\NamingStrategy
NamingStrategy determining the default column and table names
public
- $associationMappings
—
array
READ-ONLY: The association mappings of this class. - $changeTrackingPolicy
—
integer
READ-ONLY: The policy used for change-tracking on entities of this class. - $columnNames
—
array
READ-ONLY: A map of field names to column names. Keys are field names and values column names. - $containsForeignIdentifier
—
boolean
READ-ONLY: Flag indicating wheather the identifier/primary key contains at least one foreign key association. - $customGeneratorDefinition
—
array
READ-ONLY: The definition of custom generator. Only used for CUSTOM generator type - $customRepositoryClassName
—
string
The name of the custom repository class used for the entity class. - $discriminatorColumn
—
array
READ-ONLY: The definition of the discriminator column used in JOINED and SINGLE_TABLE inheritance mappings. - $discriminatorMap
—
mixed
READ-ONLY: The discriminator map of all mapped classes in the hierarchy. - $discriminatorValue
—
mixed
READ-ONLY: The discriminator value of this class. - $fieldMappings
—
array
READ-ONLY: The field mappings of the class. - $fieldNames
—
array
READ-ONLY: An array of field names. Used to look up field names from column names. - $generatorType
—
string
READ-ONLY: The Id generator type used by the class. - $idGenerator
—
\Doctrine\ORM\Id\AbstractIdGenerator
READ-ONLY: The ID generator used for generating IDs for this class. - $identifier
—
array
READ-ONLY: The field names of all fields that are part of the identifier/primary key of the mapped entity class. - $inheritanceType
—
integer
READ-ONLY: The inheritance mapping type used by the class. - $isIdentifierComposite
—
boolean
READ-ONLY: Flag indicating whether the identifier/primary key of the class is composite. - $isMappedSuperclass
—
boolean
READ-ONLY: Whether this class describes the mapping of a mapped superclass. - $isReadOnly
—
Doctrine\ORM\Mapping\bool
Is this entity marked as "read-only"? - $isVersioned
—
boolean
READ-ONLY: A flag for whether or not instances of this class are to be versioned with optimistic locking. - $lifecycleCallbacks
—
array
READ-ONLY: The registered lifecycle callbacks for entities of this class. -
$name
READ-ONLY: The name of the entity class. -
$namedNativeQueries
READ-ONLY: The named native queries allowed to be called directly from Repository. - $namedQueries
—
array
READ-ONLY: The named queries allowed to be called directly from Repository. - $namespace
—
string
READ-ONLY: The namespace the entity class is contained in. - $parentClasses
—
array
READ-ONLY: The names of the parent classes (ancestors). - $reflClass
—
ReflectionClass
The ReflectionClass instance of the mapped class. - $reflFields
—
array
The ReflectionProperty instances of the mapped class. - $rootEntityName
—
string
READ-ONLY: The name of the entity class that is at the root of the mapped entity inheritance hierarchy. If the entity is not part of a mapped inheritance hierarchy this is the same as {@link $entityName}. - $sequenceGeneratorDefinition
—
array
READ-ONLY: The definition of the sequence generator of this class. Only used for the SEQUENCE generation strategy. -
$sqlResultSetMappings
READ-ONLY: The mappings of the results of native SQL queries. - $subClasses
—
array
READ-ONLY: The names of all subclasses (descendants). - $table
—
array
READ-ONLY: The primary table definition. The definition is an array with the following entries: - $tableGeneratorDefinition
—
array
READ-ONLY: The definition of the table generator of this class. Only used for the TABLE generation strategy. - $versionField
—
mixed
READ-ONLY: The name of the field which is used for versioning in optimistic locking (if any).
Methods
private
- _isInheritanceType() — Checks whether the given type identifies an inheritance type.
protected
- _storeAssociationMapping() — Stores the association mapping.
- _validateAndCompleteAssociationMapping() — Validates & completes the basic mapping information that is common to all association mappings (one-to-one, many-ot-one, one-to-many, many-to-many).
- _validateAndCompleteFieldMapping() — Validates & completes the given field mapping.
- _validateAndCompleteManyToManyMapping()
- _validateAndCompleteOneToManyMapping() — Validates and completes the mapping.
- _validateAndCompleteOneToOneMapping() — Validates & completes a one-to-one association mapping.
public
- __construct() — Initializes a new ClassMetadata instance that will hold the object-relational mapping metadata of the class with the given name.
- __sleep() — Determines which fields get serialized.
- __toString() — Creates a string representation of this instance.
- addDiscriminatorMapClass() — Add one entry of the discriminator map with a new class and corresponding name.
- addInheritedAssociationMapping() — INTERNAL: Adds an association mapping without completing/validating it.
- addInheritedFieldMapping() — INTERNAL: Adds a field mapping without completing/validating it.
- addLifecycleCallback() — Adds a lifecycle callback for entities of this class.
- addNamedNativeQuery() — INTERNAL: Adds a named native query to this class.
- addNamedQuery() — INTERNAL: Adds a named query to this class.
- addSqlResultSetMapping() — INTERNAL: Adds a sql result set mapping to this class.
- getAssociationMappedByTargetField() — {@inheritDoc}
- getAssociationMapping() — Gets the mapping of an association.
- getAssociationMappings() — Gets all association mappings of the class.
- getAssociationNames() — {@inheritDoc}
- getAssociationTargetClass() — {@inheritDoc}
- getAssociationsByTargetClass()
- getColumnName() — Gets a column name for a field name.
- getColumnNames() — Gets an array containing all the column names.
- getFieldForColumn() — Used to retrieve a fieldname for either field or association from a given column,
- getFieldMapping() — Gets the mapping of a (regular) field that holds some data but not a reference to another object.
- getFieldName() — Gets the field name for a column name.
- getFieldNames() — {@inheritDoc}
- getFieldValue() — Gets the specified field's value off the given entity.
- getIdentifier() — Gets the mapped identifier field of this class.
- getIdentifierColumnNames() — Returns an array with all the identifier column names.
- getIdentifierFieldNames() — {@inheritDoc}
- getIdentifierValues() — Extracts the identifier values of an entity of this class.
- getLifecycleCallbacks() — Gets the registered lifecycle callbacks for an event.
- getName() — {@inheritDoc}
- getNamedNativeQueries() — Gets all named native queries of the class.
- getNamedNativeQuery() — Gets the named native query.
- getNamedQueries() — Gets all named queries of the class.
- getNamedQuery() — Gets the named query.
- getQuotedColumnName() — Gets the (possibly quoted) column name of a mapped field for safe use in an SQL statement.
- getQuotedIdentifierColumnNames() — Gets the (possibly quoted) identifier column names for safe use in an SQL statement.
- getQuotedJoinTableName() — Gets the (possibly quoted) name of the join table.
- getQuotedTableName() — Gets the (possibly quoted) primary table name of this class for safe use in an SQL statement.
- getReflectionClass() — {@inheritDoc}
- getReflectionProperties() — Gets the ReflectionPropertys of the mapped class.
- getReflectionProperty() — Gets a ReflectionProperty for a specific field of the mapped class.
- getSingleAssociationJoinColumnName() — Return the single association join column (if any).
- getSingleAssociationReferencedJoinColumnName() — Return the single association referenced join column name (if any).
- getSingleIdReflectionProperty() — Gets the ReflectionProperty for the single identifier field.
- getSingleIdentifierColumnName() — Gets the column name of the single id column. Note that this only works on entity classes that have a single-field pk.
- getSingleIdentifierFieldName() — Gets the name of the single id field. Note that this only works on entity classes that have a single-field pk.
- getSqlResultSetMapping() — Gets the result set mapping.
- getSqlResultSetMappings() — Gets all sql result set mappings of the class.
- getTableName() — Gets the name of the primary table.
- getTemporaryIdTableName() — Gets the table name to use for temporary identifier tables of this class.
- getTypeOfColumn() — Gets the type of a column.
- getTypeOfField() — Gets the type of a field.
- hasAssociation() — {@inheritDoc}
- hasField() — {@inheritDoc}
- hasLifecycleCallbacks() — Whether the class has any attached lifecycle listeners or callbacks for a lifecycle event.
- hasNamedNativeQuery() — Checks whether the class has a named native query with the given query name.
- hasNamedQuery() — Checks whether the class has a named query with the given query name.
- hasSqlResultSetMapping() — Checks whether the class has a named native query with the given query name.
- initializeReflection() — Initializes a new ClassMetadata instance that will hold the object-relational mapping metadata of the class with the given name.
- invokeLifecycleCallbacks() — Dispatches the lifecycle event of the given entity to the registered lifecycle callbacks and lifecycle listeners.
- isAssociationInverseSide() — {@inheritDoc}
- isAssociationWithSingleJoinColumn() — Is this an association that only has a single join column?
- isChangeTrackingDeferredExplicit() — Whether the change tracking policy of this class is "deferred explicit".
- isChangeTrackingDeferredImplicit() — Whether the change tracking policy of this class is "deferred implicit".
- isChangeTrackingNotify() — Whether the change tracking policy of this class is "notify".
- isCollectionValuedAssociation() — {@inheritDoc}
- isIdGeneratorIdentity() — Checks whether the class uses an identity column for the Id generation.
- isIdGeneratorSequence() — Checks whether the class uses a sequence for id generation.
- isIdGeneratorTable() — Checks whether the class uses a table for id generation.
- isIdentifier() — Checks whether a field is part of the identifier/primary key field(s).
- isIdentifierNatural() — Checks whether the class has a natural identifier/pk (which means it does not use any Id generator.
- isIdentifierUuid() — Checks whether the class use a UUID for id generation
- isInheritanceTypeJoined() — Checks whether the mapped class uses the JOINED inheritance mapping strategy.
- isInheritanceTypeNone()
- isInheritanceTypeSingleTable() — Checks whether the mapped class uses the SINGLE_TABLE inheritance mapping strategy.
- isInheritanceTypeTablePerClass() — Checks whether the mapped class uses the TABLE_PER_CLASS inheritance mapping strategy.
- isInheritedAssociation() — Checks whether a mapped association field is inherited from a superclass.
- isInheritedField() — Checks whether a mapped field is inherited from an entity superclass.
- isNullable() — Check if the field is not null.
- isRootEntity() — Check if this entity is the root in any entity-inheritance-hierachy.
- isSingleValuedAssociation() — {@inheritDoc}
- isUniqueField() — Check if the field is unique.
- mapField() — Adds a mapped field to the class.
- mapManyToMany() — Adds a many-to-many mapping.
- mapManyToOne() — Adds a many-to-one mapping.
- mapOneToMany() — Adds a one-to-many mapping.
- mapOneToOne() — Adds a one-to-one mapping.
- markReadOnly() — Mark this class as read only, no change tracking is applied to it.
- newInstance() — Creates a new instance of the mapped class, without invoking the constructor.
- setAssociationOverride() — Sets the association to override association mapping of property for an entity relationship.
- setAttributeOverride() — Sets the override for a mapped field.
- setChangeTrackingPolicy() — Sets the change tracking policy used by this class.
- setCustomGeneratorDefinition() — Sets definition
- setCustomRepositoryClass() — Registers a custom repository class for the entity class.
- setDiscriminatorColumn() — Sets the discriminator column definition.
- setDiscriminatorMap() — Sets the discriminator values used by this class.
- setFieldValue() — Sets the specified field to the specified value on the given entity.
- setIdGenerator() — Sets the ID generator used to generate IDs for instances of this class.
- setIdGeneratorType() — Sets the type of Id generator to use for the mapped class.
- setIdentifier() — INTERNAL: Sets the mapped identifier/primary key fields of this class.
- setIdentifierValues() — Populates the entity identifier of an entity.
- setInheritanceType() — Sets the inheritance type used by the class and it's subclasses.
- setLifecycleCallbacks() — Sets the lifecycle callbacks for entities of this class.
- setParentClasses() — Sets the parent class names.
- setPrimaryTable() — Sets the primary table definition. The provided array supports the following structure:
- setSequenceGeneratorDefinition() — Sets the definition of the sequence ID generator for this class.
- setSubclasses() — Sets the mapped subclasses of this class.
- setTableName() — Sets the name of the primary table the class is mapped to.
- setVersionField() — Sets the name of the field that is to be used for versioning if this class is versioned for optimistic locking.
- setVersionMapping() — Sets the version field mapping used for versioning. Sets the default value to use depending on the column type.
- setVersioned() — Sets whether this class is to be versioned for optimistic locking.
- usesIdGenerator() — Checks whether the mapped class uses an Id generator.
- validateAssocations() — Validate association targets actually exist.
- validateIdentifier() — Validate Identifier
- validateLifecycleCallbacks() — Validate lifecycle callbacks
- wakeupReflection() — Restores some state that can not be serialized/unserialized.