ClassMetadataInfo
in package
implements
ClassMetadata
A <tt>ClassMetadata</tt> instance holds all the object-relational mapping metadata of an entity and its associations.
Once populated, ClassMetadata instances are usually cached in a serialized form.
IMPORTANT NOTE:
The fields of this class are only public for 2 reasons:
- To allow fast READ access.
- 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).
Tags
Table of Contents
Interfaces
- ClassMetadata
- Contract for a Doctrine persistence layer ClassMetadata class to implement.
Constants
- CACHE_USAGE_NONSTRICT_READ_WRITE = 2
- Nonstrict Read Write Cache doesn’t employ any locks but can do inserts, update and deletes.
- CACHE_USAGE_READ_ONLY = 1
- ReadOnly cache can do reads, inserts and deletes, cannot perform updates or employ any locks,
- CACHE_USAGE_READ_WRITE = 3
- Read Write Attempts to lock the entity before update/delete.
- CHANGETRACKING_DEFERRED_EXPLICIT = 2
- DEFERRED_EXPLICIT means that changes of entities are calculated at commit-time by doing a property-by-property comparison with the original data. This will be done only for entities that were explicitly saved (through persist() or a cascade).
- CHANGETRACKING_DEFERRED_IMPLICIT = 1
- DEFERRED_IMPLICIT means that changes of entities are calculated at commit-time by doing a property-by-property comparison with the original data. This will be done for all entities that are in MANAGED state at commit-time.
- CHANGETRACKING_NOTIFY = 3
- NOTIFY means that Doctrine relies on the entities sending out notifications when their properties change. Such entity classes must implement the <tt>NotifyPropertyChanged</tt> interface.
- FETCH_EAGER = 3
- Specifies that an association is to be fetched when the owner of the association is fetched.
- FETCH_EXTRA_LAZY = 4
- Specifies that an association is to be fetched lazy (on first access) and that commands such as Collection#count, Collection#slice are issued directly against the database if the collection is not yet initialized.
- FETCH_LAZY = 2
- Specifies that an association is to be fetched when it is first accessed.
- GENERATED_ALWAYS = 2
- The value of this column is generated by the database on both INSERT and UDPATE statements.
- GENERATED_INSERT = 1
- The value of this column is generated by the database on INSERT, but not on UPDATE.
- GENERATED_NEVER = 0
- The value of this column is never generated by the database.
- GENERATOR_TYPE_AUTO = 1
- AUTO means the generator type will depend on what the used platform prefers.
- GENERATOR_TYPE_CUSTOM = 7
- CUSTOM means that customer will use own ID generator that supposedly work
- GENERATOR_TYPE_IDENTITY = 4
- IDENTITY means an identity column is used for id generation. The database will fill in the id column on insertion. Platforms that do not support native identity columns may emulate them. Full portability is currently not guaranteed.
- GENERATOR_TYPE_NONE = 5
- NONE means the class does not have a generated id. That means the class must have a natural, manually assigned id.
- GENERATOR_TYPE_SEQUENCE = 2
- SEQUENCE means a separate sequence object will be used. Platforms that do not have native sequence support may emulate it. Full portability is currently not guaranteed.
- GENERATOR_TYPE_TABLE = 3
- TABLE means a separate table is used for id generation.
- GENERATOR_TYPE_UUID = 6
- UUID means that a UUID/GUID expression is used for id generation. Full portability is currently not guaranteed.
- INHERITANCE_TYPE_JOINED = 2
- JOINED means the class will be persisted according to the rules of <tt>Class Table Inheritance</tt>.
- INHERITANCE_TYPE_NONE = 1
- NONE means the class does not participate in an inheritance hierarchy and therefore does not need an inheritance mapping type.
- INHERITANCE_TYPE_SINGLE_TABLE = 3
- SINGLE_TABLE means the class will be persisted according to the rules of <tt>Single Table Inheritance</tt>.
- INHERITANCE_TYPE_TABLE_PER_CLASS = 4
- TABLE_PER_CLASS means the class will be persisted according to the rules of <tt>Concrete Table Inheritance</tt>.
- MANY_TO_MANY = 8
- Identifies a many-to-many association.
- MANY_TO_ONE = 2
- Identifies a many-to-one association.
- ONE_TO_MANY = 4
- Identifies a one-to-many association.
- ONE_TO_ONE = 1
- Identifies a one-to-one association.
- TO_MANY = 12
- Combined bitmask for to-many (collection-valued) associations.
- TO_ONE = 3
- Combined bitmask for to-one (single-valued) associations.
Properties
- $associationMappings : mixed
- READ-ONLY: The association mappings of this class.
- $cache : array<string|int, mixed>|null
- $changeTrackingPolicy : int
- READ-ONLY: The policy used for change-tracking on entities of this class.
- $columnNames : array<string|int, mixed>
- READ-ONLY: A map of field names to column names. Keys are field names and values column names.
- $containsEnumIdentifier : bool
- READ-ONLY: Flag indicating whether the identifier/primary key contains at least one ENUM type.
- $containsForeignIdentifier : bool
- READ-ONLY: Flag indicating whether the identifier/primary key contains at least one foreign key association.
- $customGeneratorDefinition : array<string, string>|null
- READ-ONLY: The definition of custom generator. Only used for CUSTOM generator type
- $customRepositoryClassName : string|null
- The name of the custom repository class used for the entity class.
- $discriminatorColumn : array<string, mixed>
- READ-ONLY: The definition of the discriminator column used in JOINED and SINGLE_TABLE inheritance mappings.
- $discriminatorMap : array<int|string, string>
- READ-ONLY: The discriminator map of all mapped classes in the hierarchy.
- $discriminatorValue : mixed
- READ-ONLY: The discriminator value of this class.
- $embeddedClasses : mixed
- READ-ONLY: The names of all embedded classes based on properties.
- $entityListeners : mixed
- READ-ONLY: The registered entity listeners.
- $fieldMappings : array<string|int, mixed>
- READ-ONLY: The field mappings of the class.
- $fieldNames : mixed
- READ-ONLY: An array of field names. Used to look up field names from column names.
- $generatorType : int
- READ-ONLY: The Id generator type used by the class.
- $identifier : mixed
- READ-ONLY: The field names of all fields that are part of the identifier/primary key of the mapped entity class.
- $idGenerator : AbstractIdGenerator
- READ-ONLY: The ID generator used for generating IDs for this class.
- $inheritanceType : int
- READ-ONLY: The inheritance mapping type used by the class.
- $isEmbeddedClass : bool
- READ-ONLY: Whether this class describes the mapping of an embeddable class.
- $isIdentifierComposite : bool
- READ-ONLY: Flag indicating whether the identifier/primary key of the class is composite.
- $isMappedSuperclass : bool
- READ-ONLY: Whether this class describes the mapping of a mapped superclass.
- $isReadOnly : bool
- Is this entity marked as "read-only"?
- $isVersioned : bool
- READ-ONLY: A flag for whether or not instances of this class are to be versioned with optimistic locking.
- $lifecycleCallbacks : mixed
- READ-ONLY: The registered lifecycle callbacks for entities of this class.
- $name : string
- READ-ONLY: The name of the entity class.
- $namedNativeQueries : mixed
- READ-ONLY: The named native queries allowed to be called directly from Repository.
- $namedQueries : mixed
- 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 : mixed
- READ-ONLY: The names of the parent <em>entity</em> classes (ancestors), starting with the nearest one and ending with the root entity class.
- $reflClass : ReflectionClass|null
- The ReflectionClass instance of the mapped class.
- $reflFields : array<string, ReflectionProperty|null>
- The ReflectionProperty instances of the mapped class.
- $requiresFetchAfterChange : bool
- READ-ONLY: A Flag indicating whether one or more columns of this class have to be reloaded after insert / update operations.
- $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 $name}.
- $sequenceGeneratorDefinition : array<string, mixed>|null
- READ-ONLY: The definition of the sequence generator of this class. Only used for the SEQUENCE generation strategy.
- $sqlResultSetMappings : mixed
- READ-ONLY: The mappings of the results of native SQL queries.
- $subClasses : mixed
- READ-ONLY: For classes in inheritance mapping hierarchies, this field contains the names of all <em>entity</em> subclasses of this class. These may also be abstract classes.
- $table : array<string|int, mixed>
- READ-ONLY: The primary table definition. The definition is an array with the following entries:
- $tableGeneratorDefinition : array<string, mixed>
- READ-ONLY: The definition of the table generator of this class. Only used for the TABLE generation strategy.
- $versionField : string|null
- READ-ONLY: The name of the field which is used for versioning in optimistic locking (if any).
- $namingStrategy : NamingStrategy
- NamingStrategy determining the default column and table names.
- $instantiator : InstantiatorInterface|null
- $typedFieldMapper : TypedFieldMapper
Methods
- __construct() : mixed
- Initializes a new ClassMetadata instance that will hold the object-relational mapping metadata of the class with the given name.
- __sleep() : array<string|int, string>
- Determines which fields get serialized.
- __toString() : string
- Creates a string representation of this instance.
- addDiscriminatorMapClass() : void
- Adds one entry of the discriminator map with a new class and corresponding name.
- addEntityListener() : void
- Adds a entity listener for entities of this class.
- addInheritedAssociationMapping() : void
- INTERNAL: Adds an association mapping without completing/validating it.
- addInheritedFieldMapping() : void
- INTERNAL: Adds a field mapping without completing/validating it.
- addLifecycleCallback() : void
- Adds a lifecycle callback for entities of this class.
- addNamedNativeQuery() : void
- INTERNAL: Adds a named native query to this class.
- addNamedQuery() : void
- INTERNAL: Adds a named query to this class.
- addSqlResultSetMapping() : void
- INTERNAL: Adds a sql result set mapping to this class.
- addSubClass() : void
- addSubClasses() : void
- enableAssociationCache() : void
- enableCache() : void
- fullyQualifiedClassName() : string|null
- getAssociationCacheDefaults() : array<string|int, int>|array<string|int, string>
- getAssociationMappedByTargetField() : string
- Returns the target field of the owning side of the association.
- getAssociationMapping() : array<string|int, mixed>
- Gets the mapping of an association.
- getAssociationMappings() : mixed
- Gets all association mappings of the class.
- getAssociationNames() : array<int, string>
- Returns a numerically indexed list of association names of this persistent class.
- getAssociationsByTargetClass() : array<string|int, array<string|int, mixed>>
- getAssociationTargetClass() : string
- Returns the target class name of the given association.
- getColumnName() : string
- Gets a column name for a field name.
- getColumnNames() : array<string|int, mixed>
- Gets an array containing all the column names.
- getDiscriminatorColumn() : array<string, mixed>
- getFieldForColumn() : string
- Used to retrieve a fieldname for either field or association from a given column.
- getFieldMapping() : array<string|int, mixed>
- Gets the mapping of a (regular) field that holds some data but not a reference to another object.
- getFieldName() : string
- Gets the field name for a column name.
- getFieldNames() : array<int, string>
- A numerically indexed list of field names of this persistent class.
- getFieldValue() : mixed
- Gets the specified field's value off the given entity.
- getIdentifier() : array<int, string>
- Gets the mapped identifier field name.
- getIdentifierColumnNames() : mixed
- Returns an array with all the identifier column names.
- getIdentifierFieldNames() : array<int, string>
- Returns an array of identifier field names numerically indexed.
- getIdentifierValues() : array<string, mixed>
- Extracts the identifier values of an entity of this class.
- getLifecycleCallbacks() : array<string|int, string>
- Gets the registered lifecycle callbacks for an event.
- getMetadataValue() : mixed
- getName() : string
- Gets the fully-qualified class name of this persistent class.
- getNamedNativeQueries() : mixed
- Gets all named native queries of the class.
- getNamedNativeQuery() : array<string|int, mixed>
- Gets the named native query.
- getNamedQueries() : array<string|int, array<string|int, mixed>>
- Gets all named queries of the class.
- getNamedQuery() : string
- Gets the named query.
- getQuotedColumnName() : string
- Gets the (possibly quoted) column name of a mapped field for safe use in an SQL statement.
- getQuotedIdentifierColumnNames() : array<string|int, string>
- Gets the (possibly quoted) identifier column names for safe use in an SQL statement.
- getQuotedJoinTableName() : string
- Gets the (possibly quoted) name of the join table.
- getQuotedTableName() : string
- Gets the (possibly quoted) primary table name of this class for safe use in an SQL statement.
- getReflectionClass() : ReflectionClass<string|int, T>
- Gets the ReflectionClass instance for this mapped class.
- getReflectionProperties() : array<string|int, ReflectionProperty>|array<string|int, null>
- Gets the ReflectionProperties of the mapped class.
- getReflectionProperty() : ReflectionProperty
- Gets a ReflectionProperty for a specific field of the mapped class.
- getSchemaName() : string|null
- Gets primary table's schema name.
- getSequenceName() : string
- Gets the sequence name based on class metadata.
- getSequencePrefix() : string
- Gets the sequence name prefix based on class metadata.
- getSingleAssociationJoinColumnName() : string
- Returns the single association join column (if any).
- getSingleAssociationReferencedJoinColumnName() : string
- Returns the single association referenced join column name (if any).
- getSingleIdentifierColumnName() : string
- Gets the column name of the single id column. Note that this only works on entity classes that have a single-field pk.
- getSingleIdentifierFieldName() : string
- Gets the name of the single id field. Note that this only works on entity classes that have a single-field pk.
- getSingleIdReflectionProperty() : ReflectionProperty
- Gets the ReflectionProperty for the single identifier field.
- getSqlResultSetMapping() : array<string|int, mixed>
- Gets the result set mapping.
- getSqlResultSetMappings() : array<string|int, mixed>
- Gets all sql result set mappings of the class.
- getTableName() : string
- Gets the name of the primary table.
- getTemporaryIdTableName() : string
- Gets the table name to use for temporary identifier tables of this class.
- getTypeOfColumn() : string|null
- Gets the type of a column.
- getTypeOfField() : string|null
- Gets the type of a field.
- hasAssociation() : bool
- Checks if the given field is a mapped association for this class.
- hasField() : bool
- Checks if the given field is a mapped property for this class.
- hasLifecycleCallbacks() : bool
- Whether the class has any attached lifecycle listeners or callbacks for a lifecycle event.
- hasNamedNativeQuery() : bool
- Checks whether the class has a named native query with the given query name.
- hasNamedQuery() : bool
- Checks whether the class has a named query with the given query name.
- hasSqlResultSetMapping() : bool
- Checks whether the class has a named native query with the given query name.
- initializeReflection() : void
- Initializes a new ClassMetadata instance that will hold the object-relational mapping metadata of the class with the given name.
- inlineEmbeddable() : void
- Inline the embeddable class
- invokeLifecycleCallbacks() : void
- Dispatches the lifecycle event of the given entity to the registered lifecycle callbacks and lifecycle listeners.
- isAssociationInverseSide() : bool
- Checks if the association is the inverse side of a bidirectional association.
- isAssociationWithSingleJoinColumn() : bool
- Is this an association that only has a single join column?
- isChangeTrackingDeferredExplicit() : bool
- Whether the change tracking policy of this class is "deferred explicit".
- isChangeTrackingDeferredImplicit() : bool
- Whether the change tracking policy of this class is "deferred implicit".
- isChangeTrackingNotify() : bool
- Whether the change tracking policy of this class is "notify".
- isCollectionValuedAssociation() : bool
- Checks if the given field is a mapped collection valued association for this class.
- isIdentifier() : bool
- Checks whether a field is part of the identifier/primary key field(s).
- isIdentifierNatural() : bool
- Checks whether the class has a natural identifier/pk (which means it does not use any Id generator.
- isIdentifierUuid() : bool
- Checks whether the class use a UUID for id generation.
- isIdGeneratorIdentity() : bool
- Checks whether the class uses an identity column for the Id generation.
- isIdGeneratorSequence() : bool
- Checks whether the class uses a sequence for id generation.
- isIdGeneratorTable() : false
- Checks whether the class uses a table for id generation.
- isInheritanceTypeJoined() : bool
- Checks whether the mapped class uses the JOINED inheritance mapping strategy.
- isInheritanceTypeNone() : bool
- isInheritanceTypeSingleTable() : bool
- Checks whether the mapped class uses the SINGLE_TABLE inheritance mapping strategy.
- isInheritanceTypeTablePerClass() : bool
- Checks whether the mapped class uses the TABLE_PER_CLASS inheritance mapping strategy.
- isInheritedAssociation() : bool
- Checks whether a mapped association field is inherited from a superclass.
- isInheritedEmbeddedClass() : bool
- isInheritedField() : bool
- Checks whether a mapped field is inherited from an entity superclass.
- isNullable() : bool
- Checks if the field is not null.
- isRootEntity() : bool
- Checks if this entity is the root in any entity-inheritance-hierarchy.
- isSingleValuedAssociation() : bool
- Checks if the given field is a mapped single valued association for this class.
- isUniqueField() : bool
- Checks if the field is unique.
- mapEmbedded() : void
- Map Embedded Class
- mapField() : void
- Adds a mapped field to the class.
- mapManyToMany() : void
- Adds a many-to-many mapping.
- mapManyToOne() : void
- Adds a many-to-one mapping.
- mapOneToMany() : void
- Adds a one-to-many mapping.
- mapOneToOne() : void
- Adds a one-to-one mapping.
- markReadOnly() : void
- Marks this class as read only, no change tracking is applied to it.
- newInstance() : object
- Creates a new instance of the mapped class, without invoking the constructor.
- setAssociationOverride() : void
- Sets the association to override association mapping of property for an entity relationship.
- setAttributeOverride() : void
- Sets the override for a mapped field.
- setChangeTrackingPolicy() : void
- Sets the change tracking policy used by this class.
- setCustomGeneratorDefinition() : void
- Sets definition.
- setCustomRepositoryClass() : void
- Registers a custom repository class for the entity class.
- setDiscriminatorColumn() : void
- Sets the discriminator column definition.
- setDiscriminatorMap() : void
- Sets the discriminator values used by this class.
- setFieldValue() : void
- Sets the specified field to the specified value on the given entity.
- setIdentifier() : void
- INTERNAL: Sets the mapped identifier/primary key fields of this class.
- setIdentifierValues() : void
- Populates the entity identifier of an entity.
- setIdGenerator() : void
- Sets the ID generator used to generate IDs for instances of this class.
- setIdGeneratorType() : void
- Sets the type of Id generator to use for the mapped class.
- setInheritanceType() : void
- Sets the inheritance type used by the class and its subclasses.
- setLifecycleCallbacks() : void
- Sets the lifecycle callbacks for entities of this class.
- setParentClasses() : void
- Sets the parent class names. Only <em>entity</em> classes may be given.
- setPrimaryTable() : void
- Sets the primary table definition. The provided array supports the following structure:
- setSequenceGeneratorDefinition() : void
- Sets the definition of the sequence ID generator for this class.
- setSubclasses() : void
- Sets the mapped subclasses of this class.
- setTableName() : void
- Sets the name of the primary table the class is mapped to.
- setVersioned() : void
- Sets whether this class is to be versioned for optimistic locking.
- setVersionField() : void
- Sets the name of the field that is to be used for versioning if this class is versioned for optimistic locking.
- setVersionMapping() : void
- Sets the version field mapping used for versioning. Sets the default value to use depending on the column type.
- usesIdGenerator() : bool
- Checks whether the mapped class uses an Id generator.
- validateAssociations() : void
- Validates association targets actually exist.
- validateIdentifier() : void
- Validates Identifier.
- validateLifecycleCallbacks() : void
- Validates lifecycle callbacks.
- wakeupReflection() : void
- Restores some state that can not be serialized/unserialized.
- _storeAssociationMapping() : void
- Stores the association mapping.
- _validateAndCompleteAssociationMapping() : array<string|int, mixed>
- 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).
- _validateAndCompleteManyToManyMapping() : array<string|int, mixed>
- Validates & completes a many-to-many association mapping.
- _validateAndCompleteOneToManyMapping() : array<string|int, mixed>
- Validates & completes a one-to-many association mapping.
- _validateAndCompleteOneToOneMapping() : array<string|int, mixed>
- Validates & completes a one-to-one association mapping.
- validateAndCompleteFieldMapping() : FieldMapping
- Validates & completes the given field mapping.
- assertFieldNotMapped() : void
- assertMappingOrderBy() : void
- getAccessibleProperty() : ReflectionProperty|null
- isInheritanceType() : bool
- Checks whether the given type identifies an inheritance type.
- isTypedProperty() : bool
- Checks whether given property has type
- validateAndCompleteTypedAssociationMapping() : array<string|int, mixed>
- Validates & completes the basic mapping information based on typed property.
- validateAndCompleteTypedFieldMapping() : BackedEnum>, type?: string}
- Validates & completes the given field mapping based on typed property.
Constants
CACHE_USAGE_NONSTRICT_READ_WRITE
Nonstrict Read Write Cache doesn’t employ any locks but can do inserts, update and deletes.
public
mixed
CACHE_USAGE_NONSTRICT_READ_WRITE
= 2
CACHE_USAGE_READ_ONLY
ReadOnly cache can do reads, inserts and deletes, cannot perform updates or employ any locks,
public
mixed
CACHE_USAGE_READ_ONLY
= 1
CACHE_USAGE_READ_WRITE
Read Write Attempts to lock the entity before update/delete.
public
mixed
CACHE_USAGE_READ_WRITE
= 3
CHANGETRACKING_DEFERRED_EXPLICIT
DEFERRED_EXPLICIT means that changes of entities are calculated at commit-time by doing a property-by-property comparison with the original data. This will be done only for entities that were explicitly saved (through persist() or a cascade).
public
mixed
CHANGETRACKING_DEFERRED_EXPLICIT
= 2
CHANGETRACKING_DEFERRED_IMPLICIT
DEFERRED_IMPLICIT means that changes of entities are calculated at commit-time by doing a property-by-property comparison with the original data. This will be done for all entities that are in MANAGED state at commit-time.
public
mixed
CHANGETRACKING_DEFERRED_IMPLICIT
= 1
This is the default change tracking policy.
CHANGETRACKING_NOTIFY
NOTIFY means that Doctrine relies on the entities sending out notifications when their properties change. Such entity classes must implement the <tt>NotifyPropertyChanged</tt> interface.
public
mixed
CHANGETRACKING_NOTIFY
= 3
FETCH_EAGER
Specifies that an association is to be fetched when the owner of the association is fetched.
public
mixed
FETCH_EAGER
= 3
FETCH_EXTRA_LAZY
Specifies that an association is to be fetched lazy (on first access) and that commands such as Collection#count, Collection#slice are issued directly against the database if the collection is not yet initialized.
public
mixed
FETCH_EXTRA_LAZY
= 4
FETCH_LAZY
Specifies that an association is to be fetched when it is first accessed.
public
mixed
FETCH_LAZY
= 2
GENERATED_ALWAYS
The value of this column is generated by the database on both INSERT and UDPATE statements.
public
mixed
GENERATED_ALWAYS
= 2
GENERATED_INSERT
The value of this column is generated by the database on INSERT, but not on UPDATE.
public
mixed
GENERATED_INSERT
= 1
GENERATED_NEVER
The value of this column is never generated by the database.
public
mixed
GENERATED_NEVER
= 0
GENERATOR_TYPE_AUTO
AUTO means the generator type will depend on what the used platform prefers.
public
mixed
GENERATOR_TYPE_AUTO
= 1
Offers full portability.
GENERATOR_TYPE_CUSTOM
CUSTOM means that customer will use own ID generator that supposedly work
public
mixed
GENERATOR_TYPE_CUSTOM
= 7
GENERATOR_TYPE_IDENTITY
IDENTITY means an identity column is used for id generation. The database will fill in the id column on insertion. Platforms that do not support native identity columns may emulate them. Full portability is currently not guaranteed.
public
mixed
GENERATOR_TYPE_IDENTITY
= 4
GENERATOR_TYPE_NONE
NONE means the class does not have a generated id. That means the class must have a natural, manually assigned id.
public
mixed
GENERATOR_TYPE_NONE
= 5
GENERATOR_TYPE_SEQUENCE
SEQUENCE means a separate sequence object will be used. Platforms that do not have native sequence support may emulate it. Full portability is currently not guaranteed.
public
mixed
GENERATOR_TYPE_SEQUENCE
= 2
GENERATOR_TYPE_TABLE
TABLE means a separate table is used for id generation.
public
mixed
GENERATOR_TYPE_TABLE
= 3
Offers full portability (in that it results in an exception being thrown no matter the platform).
Tags
GENERATOR_TYPE_UUID
UUID means that a UUID/GUID expression is used for id generation. Full portability is currently not guaranteed.
public
mixed
GENERATOR_TYPE_UUID
= 6
Tags
INHERITANCE_TYPE_JOINED
JOINED means the class will be persisted according to the rules of <tt>Class Table Inheritance</tt>.
public
mixed
INHERITANCE_TYPE_JOINED
= 2
INHERITANCE_TYPE_NONE
NONE means the class does not participate in an inheritance hierarchy and therefore does not need an inheritance mapping type.
public
mixed
INHERITANCE_TYPE_NONE
= 1
INHERITANCE_TYPE_SINGLE_TABLE
SINGLE_TABLE means the class will be persisted according to the rules of <tt>Single Table Inheritance</tt>.
public
mixed
INHERITANCE_TYPE_SINGLE_TABLE
= 3
INHERITANCE_TYPE_TABLE_PER_CLASS
TABLE_PER_CLASS means the class will be persisted according to the rules of <tt>Concrete Table Inheritance</tt>.
public
mixed
INHERITANCE_TYPE_TABLE_PER_CLASS
= 4
Tags
MANY_TO_MANY
Identifies a many-to-many association.
public
mixed
MANY_TO_MANY
= 8
MANY_TO_ONE
Identifies a many-to-one association.
public
mixed
MANY_TO_ONE
= 2
ONE_TO_MANY
Identifies a one-to-many association.
public
mixed
ONE_TO_MANY
= 4
ONE_TO_ONE
Identifies a one-to-one association.
public
mixed
ONE_TO_ONE
= 1
TO_MANY
Combined bitmask for to-many (collection-valued) associations.
public
mixed
TO_MANY
= 12
TO_ONE
Combined bitmask for to-one (single-valued) associations.
public
mixed
TO_ONE
= 3
Properties
$associationMappings
READ-ONLY: The association mappings of this class.
public
mixed
$associationMappings
= []
The mapping definition array supports the following keys:
-
fieldName (string) The name of the field in the entity the association is mapped to.
-
sourceEntity (string) The class name of the source entity. In the case of to-many associations initially present in mapped superclasses, the nearest entity subclasses will be considered the respective source entities.
-
targetEntity (string) The class name of the target entity. If it is fully-qualified it is used as is. If it is a simple, unqualified class name the namespace is assumed to be the same as the namespace of the source entity.
-
mappedBy (string, required for bidirectional associations) The name of the field that completes the bidirectional association on the owning side. This key must be specified on the inverse side of a bidirectional association.
-
inversedBy (string, required for bidirectional associations) The name of the field that completes the bidirectional association on the inverse side. This key must be specified on the owning side of a bidirectional association.
-
cascade (array, optional) The names of persistence operations to cascade on the association. The set of possible values are: "persist", "remove", "detach", "merge", "refresh", "all" (implies all others).
-
orderBy (array, one-to-many/many-to-many only) A map of field names (of the target entity) to sorting directions (ASC/DESC). Example: array('priority' => 'desc')
-
fetch (integer, optional) The fetching strategy to use for the association, usually defaults to FETCH_LAZY. Possible values are: ClassMetadata::FETCH_EAGER, ClassMetadata::FETCH_LAZY.
-
joinTable (array, optional, many-to-many only) Specification of the join table and its join columns (foreign keys). Only valid for many-to-many mappings. Note that one-to-many associations can be mapped through a join table by simply mapping the association as many-to-many with a unique constraint on the join table.
-
indexBy (string, optional, to-many only) Specification of a field on target-entity that is used to index the collection by. This field HAS to be either the primary key or a unique column. Otherwise the collection does not contain all the entities that are actually related.
-
'inherited' (string, optional) This is set when the association is inherited by this class from another (inheritance) parent entity class. The value is the FQCN of the topmost entity class that contains this association. (If there are transient classes in the class hierarchy, these are ignored, so the class property may in fact come from a class further up in the PHP class hierarchy.) To-many associations initially declared in mapped superclasses are not considered 'inherited' in the nearest entity subclasses.
-
'declared' (string, optional) This is set when the association does not appear in the current class for the first time, but is initially declared in another parent entity or mapped superclass. The value is the FQCN of the topmost non-transient class that contains association information for this relationship.
A join table definition has the following structure:
array( 'name' =>, 'joinColumns' => array( ), 'inverseJoinColumns' => array( ) )
Tags
$cache
public
array<string|int, mixed>|null
$cache
$changeTrackingPolicy
READ-ONLY: The policy used for change-tracking on entities of this class.
public
int
$changeTrackingPolicy
= self::CHANGETRACKING_DEFERRED_IMPLICIT
$columnNames
READ-ONLY: A map of field names to column names. Keys are field names and values column names.
public
array<string|int, mixed>
$columnNames
= []
Used to look up column names from field names. This is the reverse lookup map of $_fieldNames.
Tags
$containsEnumIdentifier
READ-ONLY: Flag indicating whether the identifier/primary key contains at least one ENUM type.
public
bool
$containsEnumIdentifier
= false
This flag is necessary because some code blocks require special treatment of this cases.
$containsForeignIdentifier
READ-ONLY: Flag indicating whether the identifier/primary key contains at least one foreign key association.
public
bool
$containsForeignIdentifier
= false
This flag is necessary because some code blocks require special treatment of this cases.
$customGeneratorDefinition
READ-ONLY: The definition of custom generator. Only used for CUSTOM generator type
public
array<string, string>|null
$customGeneratorDefinition
The definition has the following structure:
array(
'class' => 'ClassName',
)
Tags
$customRepositoryClassName
The name of the custom repository class used for the entity class.
public
string|null
$customRepositoryClassName
(Optional).
Tags
$discriminatorColumn
READ-ONLY: The definition of the discriminator column used in JOINED and SINGLE_TABLE inheritance mappings.
public
array<string, mixed>
$discriminatorColumn
Tags
$discriminatorMap
READ-ONLY: The discriminator map of all mapped classes in the hierarchy.
public
array<int|string, string>
$discriminatorMap
= []
This does only apply to the JOINED and SINGLE_TABLE inheritance mapping strategies where a discriminator column is used.
Tags
$discriminatorValue
READ-ONLY: The discriminator value of this class.
public
mixed
$discriminatorValue
This does only apply to the JOINED and SINGLE_TABLE inheritance mapping strategies where a discriminator column is used.
Tags
$embeddedClasses
READ-ONLY: The names of all embedded classes based on properties.
public
mixed
$embeddedClasses
= []
The value (definition) array may contain, among others, the following values:
-
'inherited' (string, optional) This is set when this embedded-class field is inherited by this class from another (inheritance) parent entity class. The value is the FQCN of the topmost entity class that contains mapping information for this field. (If there are transient classes in the class hierarchy, these are ignored, so the class property may in fact come from a class further up in the PHP class hierarchy.) Fields initially declared in mapped superclasses are not considered 'inherited' in the nearest entity subclasses.
-
'declared' (string, optional) This is set when the embedded-class field does not appear for the first time in this class, but is originally declared in another parent entity or mapped superclass. The value is the FQCN of the topmost non-transient class that contains mapping information for this field.
Tags
$entityListeners
READ-ONLY: The registered entity listeners.
public
mixed
$entityListeners
= []
Tags
$fieldMappings
READ-ONLY: The field mappings of the class.
public
array<string|int, mixed>
$fieldMappings
= []
Keys are field names and values are mapping definitions.
The mapping definition array has the following values:
-
fieldName (string) The name of the field in the Entity.
-
type (string) The type name of the mapped field. Can be one of Doctrine's mapping types or a custom mapping type.
-
columnName (string, optional) The column name. Optional. Defaults to the field name.
-
length (integer, optional) The database length of the column. Optional. Default value taken from the type.
-
id (boolean, optional) Marks the field as the primary key of the entity. Multiple fields of an entity can have the id attribute, forming a composite key.
-
nullable (boolean, optional) Whether the column is nullable. Defaults to FALSE.
-
'notInsertable' (boolean, optional) Whether the column is not insertable. Optional. Is only set if value is TRUE.
-
'notUpdatable' (boolean, optional) Whether the column is updatable. Optional. Is only set if value is TRUE.
-
columnDefinition (string, optional, schema-only) The SQL fragment that is used when generating the DDL for the column.
-
precision (integer, optional, schema-only) The precision of a decimal column. Only valid if the column type is decimal.
-
scale (integer, optional, schema-only) The scale of a decimal column. Only valid if the column type is decimal.
-
'unique' (boolean, optional, schema-only) Whether a unique constraint should be generated for the column.
-
'inherited' (string, optional) This is set when the field is inherited by this class from another (inheritance) parent entity class. The value is the FQCN of the topmost entity class that contains mapping information for this field. (If there are transient classes in the class hierarchy, these are ignored, so the class property may in fact come from a class further up in the PHP class hierarchy.) Fields initially declared in mapped superclasses are not considered 'inherited' in the nearest entity subclasses.
-
'declared' (string, optional) This is set when the field does not appear for the first time in this class, but is originally declared in another parent entity or mapped superclass. The value is the FQCN of the topmost non-transient class that contains mapping information for this field.
Tags
$fieldNames
READ-ONLY: An array of field names. Used to look up field names from column names.
public
mixed
$fieldNames
= []
Keys are column names and values are field names.
Tags
$generatorType
READ-ONLY: The Id generator type used by the class.
public
int
$generatorType
= self::GENERATOR_TYPE_NONE
Tags
$identifier
READ-ONLY: The field names of all fields that are part of the identifier/primary key of the mapped entity class.
public
mixed
$identifier
= []
Tags
$idGenerator
READ-ONLY: The ID generator used for generating IDs for this class.
public
AbstractIdGenerator
$idGenerator
Tags
$inheritanceType
READ-ONLY: The inheritance mapping type used by the class.
public
int
$inheritanceType
= self::INHERITANCE_TYPE_NONE
Tags
$isEmbeddedClass
READ-ONLY: Whether this class describes the mapping of an embeddable class.
public
bool
$isEmbeddedClass
= false
$isIdentifierComposite
READ-ONLY: Flag indicating whether the identifier/primary key of the class is composite.
public
bool
$isIdentifierComposite
= false
$isMappedSuperclass
READ-ONLY: Whether this class describes the mapping of a mapped superclass.
public
bool
$isMappedSuperclass
= false
$isReadOnly
Is this entity marked as "read-only"?
public
bool
$isReadOnly
= false
That means it is never considered for change-tracking in the UnitOfWork. It is a very helpful performance optimization for entities that are immutable, either in your domain or through the relation database (coming from a view, or a history table for example).
$isVersioned
READ-ONLY: A flag for whether or not instances of this class are to be versioned with optimistic locking.
public
bool
$isVersioned
= false
$lifecycleCallbacks
READ-ONLY: The registered lifecycle callbacks for entities of this class.
public
mixed
$lifecycleCallbacks
= []
Tags
$name
READ-ONLY: The name of the entity class.
public
string
$name
Tags
$namedNativeQueries
READ-ONLY: The named native queries allowed to be called directly from Repository.
public
mixed
$namedNativeQueries
= []
A native SQL named query definition has the following structure:
array( 'name' =>, 'query' => , 'resultClass' => , 'resultSetMapping' => )
Tags
$namedQueries
READ-ONLY: The named queries allowed to be called directly from Repository.
public
mixed
$namedQueries
= []
Tags
$namespace
READ-ONLY: The namespace the entity class is contained in.
public
string
$namespace
Tags
$parentClasses
READ-ONLY: The names of the parent <em>entity</em> classes (ancestors), starting with the nearest one and ending with the root entity class.
public
mixed
$parentClasses
= []
Tags
$reflClass
The ReflectionClass instance of the mapped class.
public
ReflectionClass|null
$reflClass
$reflFields
The ReflectionProperty instances of the mapped class.
public
array<string, ReflectionProperty|null>
$reflFields
= []
$requiresFetchAfterChange
READ-ONLY: A Flag indicating whether one or more columns of this class have to be reloaded after insert / update operations.
public
bool
$requiresFetchAfterChange
= false
$rootEntityName
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 $name}.
public
string
$rootEntityName
Tags
$sequenceGeneratorDefinition
READ-ONLY: The definition of the sequence generator of this class. Only used for the SEQUENCE generation strategy.
public
array<string, mixed>|null
$sequenceGeneratorDefinition
The definition has the following structure:
array(
'sequenceName' => 'name',
'allocationSize' => '20',
'initialValue' => '1'
)
Tags
$sqlResultSetMappings
READ-ONLY: The mappings of the results of native SQL queries.
public
mixed
$sqlResultSetMappings
= []
A native result mapping definition has the following structure:
array( 'name' =>, 'entities' => array( ), 'columns' => array( ) )
Tags
$subClasses
READ-ONLY: For classes in inheritance mapping hierarchies, this field contains the names of all <em>entity</em> subclasses of this class. These may also be abstract classes.
public
mixed
$subClasses
= []
This list is used, for example, to enumerate all necessary tables in JTI when querying for root or subclass entities, or to gather all fields comprised in an entity inheritance tree.
For classes that do not use STI/JTI, this list is empty.
Implementation note:
In PHP, there is no general way to discover all subclasses of a given class at runtime. For that reason, the list of classes given in the discriminator map at the root entity is considered authoritative. The discriminator map must contain all concrete classes that can appear in the particular inheritance hierarchy tree. Since there can be no instances of abstract entity classes, users are not required to list such classes with a discriminator value.
The possibly remaining "gaps" for abstract entity classes are filled after the class metadata for the root entity has been loaded.
For subclasses of such root entities, the list can be reused/passed downwards, it only needs to be filtered accordingly (only keep remaining subclasses)
Tags
$table
READ-ONLY: The primary table definition. The definition is an array with the following entries:
public
array<string|int, mixed>
$table
name => <tableName> schema => <schemaName> indexes => array uniqueConstraints => array
Tags
$tableGeneratorDefinition
READ-ONLY: The definition of the table generator of this class. Only used for the TABLE generation strategy.
public
array<string, mixed>
$tableGeneratorDefinition
Tags
$versionField
READ-ONLY: The name of the field which is used for versioning in optimistic locking (if any).
public
string|null
$versionField
$namingStrategy
NamingStrategy determining the default column and table names.
protected
NamingStrategy
$namingStrategy
$instantiator
private
InstantiatorInterface|null
$instantiator
$typedFieldMapper
private
TypedFieldMapper
$typedFieldMapper
Methods
__construct()
Initializes a new ClassMetadata instance that will hold the object-relational mapping metadata of the class with the given name.
public
__construct(string $entityName[, NamingStrategy|null $namingStrategy = null ][, TypedFieldMapper|null $typedFieldMapper = null ]) : mixed
Parameters
- $entityName : string
-
The name of the entity class the new instance is used for.
- $namingStrategy : NamingStrategy|null = null
- $typedFieldMapper : TypedFieldMapper|null = null
Tags
__sleep()
Determines which fields get serialized.
public
__sleep() : array<string|int, string>
It is only serialized what is necessary for best unserialization performance. That means any metadata properties that are not set or empty or simply have their default value are NOT serialized.
Parts that are also NOT serialized because they can not be properly unserialized: - reflClass (ReflectionClass) - reflFields (ReflectionProperty array)
Return values
array<string|int, string> —The names of all the fields that should be serialized.
__toString()
Creates a string representation of this instance.
public
__toString() : string
Tags
Return values
string —The string representation of this instance.
addDiscriminatorMapClass()
Adds one entry of the discriminator map with a new class and corresponding name.
public
addDiscriminatorMapClass(int|string $name, string $className) : void
Parameters
- $name : int|string
- $className : string
Tags
addEntityListener()
Adds a entity listener for entities of this class.
public
addEntityListener(string $eventName, string $class, string $method) : void
Parameters
- $eventName : string
-
The entity lifecycle event.
- $class : string
-
The listener class.
- $method : string
-
The listener callback method.
Tags
addInheritedAssociationMapping()
INTERNAL: Adds an association mapping without completing/validating it.
public
addInheritedAssociationMapping(array<string|int, mixed> $mapping) : void
This is mainly used to add inherited association mappings to derived classes.
Parameters
- $mapping : array<string|int, mixed>
Tags
addInheritedFieldMapping()
INTERNAL: Adds a field mapping without completing/validating it.
public
addInheritedFieldMapping(array<string|int, mixed> $fieldMapping) : void
This is mainly used to add inherited field mappings to derived classes.
Parameters
- $fieldMapping : array<string|int, mixed>
Tags
addLifecycleCallback()
Adds a lifecycle callback for entities of this class.
public
addLifecycleCallback(string $callback, string $event) : void
Parameters
- $callback : string
- $event : string
addNamedNativeQuery()
INTERNAL: Adds a named native query to this class.
public
addNamedNativeQuery(array<string|int, mixed> $queryMapping) : void
Parameters
- $queryMapping : array<string|int, mixed>
Tags
addNamedQuery()
INTERNAL: Adds a named query to this class.
public
addNamedQuery(array<string|int, mixed> $queryMapping) : void
Parameters
- $queryMapping : array<string|int, mixed>
Tags
addSqlResultSetMapping()
INTERNAL: Adds a sql result set mapping to this class.
public
addSqlResultSetMapping(array<string|int, mixed> $resultMapping) : void
Parameters
- $resultMapping : array<string|int, mixed>
Tags
addSubClass()
public
addSubClass(string $className) : void
Parameters
- $className : string
addSubClasses()
public
addSubClasses(array<string|int, class-string> $classes) : void
Parameters
- $classes : array<string|int, class-string>
enableAssociationCache()
public
enableAssociationCache(string $fieldName, array<string|int, mixed> $cache) : void
Parameters
- $fieldName : string
- $cache : array<string|int, mixed>
Tags
enableCache()
public
enableCache(array<string|int, mixed> $cache) : void
Parameters
- $cache : array<string|int, mixed>
Tags
fullyQualifiedClassName()
public
fullyQualifiedClassName(string|null $className) : string|null
Parameters
- $className : string|null
Tags
Return values
string|null —null if the input value is null
getAssociationCacheDefaults()
public
getAssociationCacheDefaults(string $fieldName, array<string|int, mixed> $cache) : array<string|int, int>|array<string|int, string>
Parameters
- $fieldName : string
- $cache : array<string|int, mixed>
Tags
Return values
array<string|int, int>|array<string|int, string>getAssociationMappedByTargetField()
Returns the target field of the owning side of the association.
public
getAssociationMappedByTargetField(mixed $fieldName) : string
Parameters
- $fieldName : mixed
Return values
stringgetAssociationMapping()
Gets the mapping of an association.
public
getAssociationMapping(string $fieldName) : array<string|int, mixed>
Parameters
- $fieldName : string
-
The field name that represents the association in the object model.
Tags
Return values
array<string|int, mixed> —The mapping.
getAssociationMappings()
Gets all association mappings of the class.
public
getAssociationMappings() : mixed
Tags
getAssociationNames()
Returns a numerically indexed list of association names of this persistent class.
public
getAssociationNames() : array<int, string>
Return values
array<int, string>getAssociationsByTargetClass()
public
getAssociationsByTargetClass(string $targetClass) : array<string|int, array<string|int, mixed>>
Parameters
- $targetClass : string
Tags
Return values
array<string|int, array<string|int, mixed>>getAssociationTargetClass()
Returns the target class name of the given association.
public
getAssociationTargetClass(string $assocName) : string
Parameters
- $assocName : string
Tags
Return values
stringgetColumnName()
Gets a column name for a field name.
public
getColumnName(string $fieldName) : string
If the column name for the field cannot be found, the given field name is returned.
Parameters
- $fieldName : string
-
The field name.
Return values
string —The column name.
getColumnNames()
Gets an array containing all the column names.
public
getColumnNames([array<string|int, mixed>|null $fieldNames = null ]) : array<string|int, mixed>
Parameters
- $fieldNames : array<string|int, mixed>|null = null
Tags
Return values
array<string|int, mixed>getDiscriminatorColumn()
public
final getDiscriminatorColumn() : array<string, mixed>
Tags
Return values
array<string, mixed>getFieldForColumn()
Used to retrieve a fieldname for either field or association from a given column.
public
getFieldForColumn(string $columnName) : string
This method is used in foreign-key as primary-key contexts.
Parameters
- $columnName : string
Tags
Return values
stringgetFieldMapping()
Gets the mapping of a (regular) field that holds some data but not a reference to another object.
public
getFieldMapping(string $fieldName) : array<string|int, mixed>
Parameters
- $fieldName : string
-
The field name.
Tags
Return values
array<string|int, mixed> —The field mapping.
getFieldName()
Gets the field name for a column name.
public
getFieldName(string $columnName) : string
If no field name can be found the column name is returned.
Parameters
- $columnName : string
-
The column name.
Return values
string —The column alias.
getFieldNames()
A numerically indexed list of field names of this persistent class.
public
getFieldNames() : array<int, string>
Return values
array<int, string>getFieldValue()
Gets the specified field's value off the given entity.
public
getFieldValue(object $entity, string $field) : mixed
Parameters
- $entity : object
- $field : string
getIdentifier()
Gets the mapped identifier field name.
public
getIdentifier() : array<int, string>
Return values
array<int, string>getIdentifierColumnNames()
Returns an array with all the identifier column names.
public
getIdentifierColumnNames() : mixed
Tags
getIdentifierFieldNames()
Returns an array of identifier field names numerically indexed.
public
getIdentifierFieldNames() : array<int, string>
Return values
array<int, string>getIdentifierValues()
Extracts the identifier values of an entity of this class.
public
getIdentifierValues(object $entity) : array<string, mixed>
For composite identifiers, the identifier values are returned as an array with the same order as the field order in .
Parameters
- $entity : object
Return values
array<string, mixed>getLifecycleCallbacks()
Gets the registered lifecycle callbacks for an event.
public
getLifecycleCallbacks(string $event) : array<string|int, string>
Parameters
- $event : string
Tags
Return values
array<string|int, string>getMetadataValue()
public
getMetadataValue(string $name) : mixed
Parameters
- $name : string
getName()
Gets the fully-qualified class name of this persistent class.
public
getName() : string
Return values
stringgetNamedNativeQueries()
Gets all named native queries of the class.
public
getNamedNativeQueries() : mixed
Tags
getNamedNativeQuery()
Gets the named native query.
public
getNamedNativeQuery(string $queryName) : array<string|int, mixed>
Parameters
- $queryName : string
-
The query name.
Tags
Return values
array<string|int, mixed>getNamedQueries()
Gets all named queries of the class.
public
getNamedQueries() : array<string|int, array<string|int, mixed>>
Tags
Return values
array<string|int, array<string|int, mixed>>getNamedQuery()
Gets the named query.
public
getNamedQuery(string $queryName) : string
Parameters
- $queryName : string
-
The query name.
Tags
Return values
stringgetQuotedColumnName()
Gets the (possibly quoted) column name of a mapped field for safe use in an SQL statement.
public
getQuotedColumnName(string $field, AbstractPlatform $platform) : string
Parameters
- $field : string
- $platform : AbstractPlatform
Tags
Return values
stringgetQuotedIdentifierColumnNames()
Gets the (possibly quoted) identifier column names for safe use in an SQL statement.
public
getQuotedIdentifierColumnNames(AbstractPlatform $platform) : array<string|int, string>
Parameters
- $platform : AbstractPlatform
Tags
Return values
array<string|int, string>getQuotedJoinTableName()
Gets the (possibly quoted) name of the join table.
public
getQuotedJoinTableName(array<string|int, mixed> $assoc, AbstractPlatform $platform) : string
Parameters
- $assoc : array<string|int, mixed>
- $platform : AbstractPlatform
Tags
Return values
stringgetQuotedTableName()
Gets the (possibly quoted) primary table name of this class for safe use in an SQL statement.
public
getQuotedTableName(AbstractPlatform $platform) : string
Parameters
- $platform : AbstractPlatform
Tags
Return values
stringgetReflectionClass()
Gets the ReflectionClass instance for this mapped class.
public
getReflectionClass() : ReflectionClass<string|int, T>
Return values
ReflectionClass<string|int, T>getReflectionProperties()
Gets the ReflectionProperties of the mapped class.
public
getReflectionProperties() : array<string|int, ReflectionProperty>|array<string|int, null>
Tags
Return values
array<string|int, ReflectionProperty>|array<string|int, null> —An array of ReflectionProperty instances.
getReflectionProperty()
Gets a ReflectionProperty for a specific field of the mapped class.
public
getReflectionProperty(string $name) : ReflectionProperty
Parameters
- $name : string
Return values
ReflectionPropertygetSchemaName()
Gets primary table's schema name.
public
getSchemaName() : string|null
Return values
string|nullgetSequenceName()
Gets the sequence name based on class metadata.
public
getSequenceName(AbstractPlatform $platform) : string
Parameters
- $platform : AbstractPlatform
Tags
Return values
stringgetSequencePrefix()
Gets the sequence name prefix based on class metadata.
public
getSequencePrefix(AbstractPlatform $platform) : string
Parameters
- $platform : AbstractPlatform
Tags
Return values
stringgetSingleAssociationJoinColumnName()
Returns the single association join column (if any).
public
getSingleAssociationJoinColumnName(string $fieldName) : string
Parameters
- $fieldName : string
Tags
Return values
stringgetSingleAssociationReferencedJoinColumnName()
Returns the single association referenced join column name (if any).
public
getSingleAssociationReferencedJoinColumnName(string $fieldName) : string
Parameters
- $fieldName : string
Tags
Return values
stringgetSingleIdentifierColumnName()
Gets the column name of the single id column. Note that this only works on entity classes that have a single-field pk.
public
getSingleIdentifierColumnName() : string
Tags
Return values
stringgetSingleIdentifierFieldName()
Gets the name of the single id field. Note that this only works on entity classes that have a single-field pk.
public
getSingleIdentifierFieldName() : string
Tags
Return values
stringgetSingleIdReflectionProperty()
Gets the ReflectionProperty for the single identifier field.
public
getSingleIdReflectionProperty() : ReflectionProperty
Tags
Return values
ReflectionPropertygetSqlResultSetMapping()
Gets the result set mapping.
public
getSqlResultSetMapping(string $name) : array<string|int, mixed>
Parameters
- $name : string
-
The result set mapping name.
Tags
Return values
array<string|int, mixed>getSqlResultSetMappings()
Gets all sql result set mappings of the class.
public
getSqlResultSetMappings() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getTableName()
Gets the name of the primary table.
public
getTableName() : string
Return values
stringgetTemporaryIdTableName()
Gets the table name to use for temporary identifier tables of this class.
public
getTemporaryIdTableName() : string
Return values
stringgetTypeOfColumn()
Gets the type of a column.
public
getTypeOfColumn(string $columnName) : string|null
Parameters
- $columnName : string
Tags
Return values
string|nullgetTypeOfField()
Gets the type of a field.
public
getTypeOfField(string $fieldName) : string|null
Parameters
- $fieldName : string
Tags
Return values
string|nullhasAssociation()
Checks if the given field is a mapped association for this class.
public
hasAssociation(mixed $fieldName) : bool
Parameters
- $fieldName : mixed
Return values
boolhasField()
Checks if the given field is a mapped property for this class.
public
hasField(mixed $fieldName) : bool
Parameters
- $fieldName : mixed
Return values
boolhasLifecycleCallbacks()
Whether the class has any attached lifecycle listeners or callbacks for a lifecycle event.
public
hasLifecycleCallbacks(string $lifecycleEvent) : bool
Parameters
- $lifecycleEvent : string
Return values
boolhasNamedNativeQuery()
Checks whether the class has a named native query with the given query name.
public
hasNamedNativeQuery(string $queryName) : bool
Parameters
- $queryName : string
Return values
boolhasNamedQuery()
Checks whether the class has a named query with the given query name.
public
hasNamedQuery(string $queryName) : bool
Parameters
- $queryName : string
Return values
boolhasSqlResultSetMapping()
Checks whether the class has a named native query with the given query name.
public
hasSqlResultSetMapping(string $name) : bool
Parameters
- $name : string
Return values
boolinitializeReflection()
Initializes a new ClassMetadata instance that will hold the object-relational mapping metadata of the class with the given name.
public
initializeReflection(ReflectionService $reflService) : void
Parameters
- $reflService : ReflectionService
-
The reflection service.
inlineEmbeddable()
Inline the embeddable class
public
inlineEmbeddable(string $property, ClassMetadataInfo $embeddable) : void
Parameters
- $property : string
- $embeddable : ClassMetadataInfo
invokeLifecycleCallbacks()
Dispatches the lifecycle event of the given entity to the registered lifecycle callbacks and lifecycle listeners.
public
invokeLifecycleCallbacks(string $lifecycleEvent, object $entity) : void
Parameters
- $lifecycleEvent : string
-
The lifecycle event.
- $entity : object
-
The Entity on which the event occurred.
Tags
isAssociationInverseSide()
Checks if the association is the inverse side of a bidirectional association.
public
isAssociationInverseSide(mixed $fieldName) : bool
Parameters
- $fieldName : mixed
Return values
boolisAssociationWithSingleJoinColumn()
Is this an association that only has a single join column?
public
isAssociationWithSingleJoinColumn(string $fieldName) : bool
Parameters
- $fieldName : string
Return values
boolisChangeTrackingDeferredExplicit()
Whether the change tracking policy of this class is "deferred explicit".
public
isChangeTrackingDeferredExplicit() : bool
Return values
boolisChangeTrackingDeferredImplicit()
Whether the change tracking policy of this class is "deferred implicit".
public
isChangeTrackingDeferredImplicit() : bool
Return values
boolisChangeTrackingNotify()
Whether the change tracking policy of this class is "notify".
public
isChangeTrackingNotify() : bool
Return values
boolisCollectionValuedAssociation()
Checks if the given field is a mapped collection valued association for this class.
public
isCollectionValuedAssociation(mixed $fieldName) : bool
Parameters
- $fieldName : mixed
Return values
boolisIdentifier()
Checks whether a field is part of the identifier/primary key field(s).
public
isIdentifier(string $fieldName) : bool
Parameters
- $fieldName : string
-
The field name.
Return values
bool —TRUE if the field is part of the table identifier/primary key field(s), FALSE otherwise.
isIdentifierNatural()
Checks whether the class has a natural identifier/pk (which means it does not use any Id generator.
public
isIdentifierNatural() : bool
Return values
boolisIdentifierUuid()
Checks whether the class use a UUID for id generation.
public
isIdentifierUuid() : bool
Tags
Return values
boolisIdGeneratorIdentity()
Checks whether the class uses an identity column for the Id generation.
public
isIdGeneratorIdentity() : bool
Return values
bool —TRUE if the class uses the IDENTITY generator, FALSE otherwise.
isIdGeneratorSequence()
Checks whether the class uses a sequence for id generation.
public
isIdGeneratorSequence() : bool
Tags
Return values
bool —TRUE if the class uses the SEQUENCE generator, FALSE otherwise.
isIdGeneratorTable()
Checks whether the class uses a table for id generation.
public
isIdGeneratorTable() : false
Tags
Return values
falseisInheritanceTypeJoined()
Checks whether the mapped class uses the JOINED inheritance mapping strategy.
public
isInheritanceTypeJoined() : bool
Return values
bool —TRUE if the class participates in a JOINED inheritance mapping, FALSE otherwise.
isInheritanceTypeNone()
public
isInheritanceTypeNone() : bool
Return values
boolisInheritanceTypeSingleTable()
Checks whether the mapped class uses the SINGLE_TABLE inheritance mapping strategy.
public
isInheritanceTypeSingleTable() : bool
Return values
bool —TRUE if the class participates in a SINGLE_TABLE inheritance mapping, FALSE otherwise.
isInheritanceTypeTablePerClass()
Checks whether the mapped class uses the TABLE_PER_CLASS inheritance mapping strategy.
public
isInheritanceTypeTablePerClass() : bool
Tags
Return values
bool —TRUE if the class participates in a TABLE_PER_CLASS inheritance mapping, FALSE otherwise.
isInheritedAssociation()
Checks whether a mapped association field is inherited from a superclass.
public
isInheritedAssociation(string $fieldName) : bool
Parameters
- $fieldName : string
Return values
bool —TRUE if the field is inherited, FALSE otherwise.
isInheritedEmbeddedClass()
public
isInheritedEmbeddedClass(string $fieldName) : bool
Parameters
- $fieldName : string
Return values
boolisInheritedField()
Checks whether a mapped field is inherited from an entity superclass.
public
isInheritedField(string $fieldName) : bool
Parameters
- $fieldName : string
Return values
bool —TRUE if the field is inherited, FALSE otherwise.
isNullable()
Checks if the field is not null.
public
isNullable(string $fieldName) : bool
Parameters
- $fieldName : string
-
The field name.
Return values
bool —TRUE if the field is not null, FALSE otherwise.
isRootEntity()
Checks if this entity is the root in any entity-inheritance-hierarchy.
public
isRootEntity() : bool
Return values
boolisSingleValuedAssociation()
Checks if the given field is a mapped single valued association for this class.
public
isSingleValuedAssociation(mixed $fieldName) : bool
Parameters
- $fieldName : mixed
Return values
boolisUniqueField()
Checks if the field is unique.
public
isUniqueField(string $fieldName) : bool
Parameters
- $fieldName : string
-
The field name.
Return values
bool —TRUE if the field is unique, FALSE otherwise.
mapEmbedded()
Map Embedded Class
public
mapEmbedded(array<string|int, mixed> $mapping) : void
Parameters
- $mapping : array<string|int, mixed>
Tags
mapField()
Adds a mapped field to the class.
public
mapField(array<string|int, mixed> $mapping) : void
Parameters
- $mapping : array<string|int, mixed>
Tags
mapManyToMany()
Adds a many-to-many mapping.
public
mapManyToMany(array<string|int, mixed> $mapping) : void
Parameters
- $mapping : array<string|int, mixed>
Tags
mapManyToOne()
Adds a many-to-one mapping.
public
mapManyToOne(array<string|int, mixed> $mapping) : void
Parameters
- $mapping : array<string|int, mixed>
Tags
mapOneToMany()
Adds a one-to-many mapping.
public
mapOneToMany(array<string|int, mixed> $mapping) : void
Parameters
- $mapping : array<string|int, mixed>
Tags
mapOneToOne()
Adds a one-to-one mapping.
public
mapOneToOne(array<string, mixed> $mapping) : void
Parameters
- $mapping : array<string, mixed>
-
The mapping.
markReadOnly()
Marks this class as read only, no change tracking is applied to it.
public
markReadOnly() : void
newInstance()
Creates a new instance of the mapped class, without invoking the constructor.
public
newInstance() : object
Return values
objectsetAssociationOverride()
Sets the association to override association mapping of property for an entity relationship.
public
setAssociationOverride(string $fieldName, array<string|int, mixed> $overrideMapping) : void
Parameters
- $fieldName : string
- $overrideMapping : array<string|int, mixed>
Tags
setAttributeOverride()
Sets the override for a mapped field.
public
setAttributeOverride(string $fieldName, array<string|int, mixed> $overrideMapping) : void
Parameters
- $fieldName : string
- $overrideMapping : array<string|int, mixed>
Tags
setChangeTrackingPolicy()
Sets the change tracking policy used by this class.
public
setChangeTrackingPolicy(int $policy) : void
Parameters
- $policy : int
setCustomGeneratorDefinition()
Sets definition.
public
setCustomGeneratorDefinition(array<string|int, mixed> $definition) : void
Parameters
- $definition : array<string|int, mixed>
Tags
setCustomRepositoryClass()
Registers a custom repository class for the entity class.
public
setCustomRepositoryClass(string|null $repositoryClassName) : void
Parameters
- $repositoryClassName : string|null
-
The class name of the custom mapper.
Tags
setDiscriminatorColumn()
Sets the discriminator column definition.
public
setDiscriminatorColumn(array<string|int, mixed>|null $columnDef) : void
Parameters
- $columnDef : array<string|int, mixed>|null
Tags
setDiscriminatorMap()
Sets the discriminator values used by this class.
public
setDiscriminatorMap(array<int|string, string> $map) : void
Used for JOINED and SINGLE_TABLE inheritance mapping strategies.
Parameters
- $map : array<int|string, string>
setFieldValue()
Sets the specified field to the specified value on the given entity.
public
setFieldValue(object $entity, string $field, mixed $value) : void
Parameters
- $entity : object
- $field : string
- $value : mixed
setIdentifier()
INTERNAL: Sets the mapped identifier/primary key fields of this class.
public
setIdentifier(array<string|int, mixed> $identifier) : void
Mainly used by the ClassMetadataFactory to assign inherited identifiers.
Parameters
- $identifier : array<string|int, mixed>
Tags
setIdentifierValues()
Populates the entity identifier of an entity.
public
setIdentifierValues(object $entity, array<string|int, mixed> $id) : void
Parameters
- $entity : object
- $id : array<string|int, mixed>
Tags
setIdGenerator()
Sets the ID generator used to generate IDs for instances of this class.
public
setIdGenerator(AbstractIdGenerator $generator) : void
Parameters
- $generator : AbstractIdGenerator
setIdGeneratorType()
Sets the type of Id generator to use for the mapped class.
public
setIdGeneratorType(int $generatorType) : void
Parameters
- $generatorType : int
Tags
setInheritanceType()
Sets the inheritance type used by the class and its subclasses.
public
setInheritanceType(int $type) : void
Parameters
- $type : int
Tags
setLifecycleCallbacks()
Sets the lifecycle callbacks for entities of this class.
public
setLifecycleCallbacks(array<string|int, mixed> $callbacks) : void
Any previously registered callbacks are overwritten.
Parameters
- $callbacks : array<string|int, mixed>
Tags
setParentClasses()
Sets the parent class names. Only <em>entity</em> classes may be given.
public
setParentClasses(array<string|int, mixed> $classNames) : void
Assumes that the class names in the passed array are in the order: directParent -> directParentParent -> directParentParentParent ... -> root.
Parameters
- $classNames : array<string|int, mixed>
Tags
setPrimaryTable()
Sets the primary table definition. The provided array supports the following structure:
public
setPrimaryTable(array<string|int, mixed> $table) : void
name => <tableName> (optional, defaults to class name) indexes => array of indexes (optional) uniqueConstraints => array of constraints (optional)
If a key is omitted, the current value is kept.
Parameters
- $table : array<string|int, mixed>
Tags
setSequenceGeneratorDefinition()
Sets the definition of the sequence ID generator for this class.
public
setSequenceGeneratorDefinition(array<string|int, mixed> $definition) : void
The definition must have the following structure:
array(
'sequenceName' => 'name',
'allocationSize' => 20,
'initialValue' => 1
'quoted' => 1
)
Parameters
- $definition : array<string|int, mixed>
Tags
setSubclasses()
Sets the mapped subclasses of this class.
public
setSubclasses(array<string|int, mixed> $subclasses) : void
Parameters
- $subclasses : array<string|int, mixed>
Tags
setTableName()
Sets the name of the primary table the class is mapped to.
public
setTableName(string $tableName) : void
Parameters
- $tableName : string
-
The table name.
Tags
setVersioned()
Sets whether this class is to be versioned for optimistic locking.
public
setVersioned(bool $bool) : void
Parameters
- $bool : bool
setVersionField()
Sets the name of the field that is to be used for versioning if this class is versioned for optimistic locking.
public
setVersionField(string|null $versionField) : void
Parameters
- $versionField : string|null
setVersionMapping()
Sets the version field mapping used for versioning. Sets the default value to use depending on the column type.
public
setVersionMapping(array<string|int, mixed> &$mapping) : void
Parameters
- $mapping : array<string|int, mixed>
Tags
usesIdGenerator()
Checks whether the mapped class uses an Id generator.
public
usesIdGenerator() : bool
Return values
bool —TRUE if the mapped class uses an Id generator, FALSE otherwise.
validateAssociations()
Validates association targets actually exist.
public
validateAssociations() : void
Tags
validateIdentifier()
Validates Identifier.
public
validateIdentifier() : void
Tags
validateLifecycleCallbacks()
Validates lifecycle callbacks.
public
validateLifecycleCallbacks(ReflectionService $reflService) : void
Parameters
- $reflService : ReflectionService
Tags
wakeupReflection()
Restores some state that can not be serialized/unserialized.
public
wakeupReflection(ReflectionService $reflService) : void
Parameters
- $reflService : ReflectionService
_storeAssociationMapping()
Stores the association mapping.
protected
_storeAssociationMapping(array<string|int, mixed> $assocMapping) : void
Parameters
- $assocMapping : array<string|int, mixed>
Tags
_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).
protected
_validateAndCompleteAssociationMapping(array<string|int, mixed> $mapping) : array<string|int, mixed>
Parameters
- $mapping : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —The updated mapping.
_validateAndCompleteManyToManyMapping()
Validates & completes a many-to-many association mapping.
protected
_validateAndCompleteManyToManyMapping(array<string|int, mixed> $mapping) : array<string|int, mixed>
Parameters
- $mapping : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —The validated & completed mapping.
_validateAndCompleteOneToManyMapping()
Validates & completes a one-to-many association mapping.
protected
_validateAndCompleteOneToManyMapping(array<string|int, mixed> $mapping) : array<string|int, mixed>
Parameters
- $mapping : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —The validated and completed mapping.
_validateAndCompleteOneToOneMapping()
Validates & completes a one-to-one association mapping.
protected
_validateAndCompleteOneToOneMapping(array<string|int, mixed> $mapping) : array<string|int, mixed>
Parameters
- $mapping : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —The validated & completed mapping.
validateAndCompleteFieldMapping()
Validates & completes the given field mapping.
protected
validateAndCompleteFieldMapping(array<string|int, mixed> $mapping) : FieldMapping
Parameters
- $mapping : array<string|int, mixed>
Tags
Return values
FieldMapping —The updated mapping.
assertFieldNotMapped()
private
assertFieldNotMapped(string $fieldName) : void
Parameters
- $fieldName : string
Tags
assertMappingOrderBy()
private
assertMappingOrderBy(array<string|int, mixed> $mapping) : void
Parameters
- $mapping : array<string|int, mixed>
Tags
getAccessibleProperty()
private
getAccessibleProperty(ReflectionService $reflService, string $class, string $field) : ReflectionProperty|null
Parameters
- $reflService : ReflectionService
- $class : string
- $field : string
Tags
Return values
ReflectionProperty|nullisInheritanceType()
Checks whether the given type identifies an inheritance type.
private
isInheritanceType(int $type) : bool
Parameters
- $type : int
Return values
bool —TRUE if the given type identifies an inheritance type, FALSE otherwise.
isTypedProperty()
Checks whether given property has type
private
isTypedProperty(string $name) : bool
Parameters
- $name : string
-
Property name
Return values
boolvalidateAndCompleteTypedAssociationMapping()
Validates & completes the basic mapping information based on typed property.
private
validateAndCompleteTypedAssociationMapping(array{type: self::ONE_TO_ONE|self::MANY_TO_ONE|self::ONE_TO_MANY|self::MANY_TO_MANY, fieldName: string, targetEntity?: class-string} $mapping) : array<string|int, mixed>
Parameters
- $mapping : array{type: self::ONE_TO_ONE|self::MANY_TO_ONE|self::ONE_TO_MANY|self::MANY_TO_MANY, fieldName: string, targetEntity?: class-string}
-
The mapping.
Return values
array<string|int, mixed> —The updated mapping.
validateAndCompleteTypedFieldMapping()
Validates & completes the given field mapping based on typed property.
private
validateAndCompleteTypedFieldMapping(array{fieldName: string, type?: string} $mapping) : BackedEnum>, type?: string}
Parameters
- $mapping : array{fieldName: string, type?: string}
-
The field mapping to validate & complete.
Return values
BackedEnum>, type?: string} —The updated mapping.