ClassMetadataInfo
public class ClassMetadataInfo
Field Summary | |
---|---|
final int | 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. |
final int | 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. |
final int | NOTIFY means that Doctrine relies on the entities sending out notifications when their properties change. |
final int | AUTO means the generator type will depend on what the used platform prefers. |
final int | IDENTITY means an identity column is used for id generation. |
final int | NONE means the class does not have a generated id. |
final int | SEQUENCE means a separate sequence object will be used. |
final int | TABLE means a separate table is used for id generation. |
final int | JOINED means the class will be persisted according to the rules of Class Table Inheritance. |
final int | NONE means the class does not participate in an inheritance hierarchy and therefore does not need an inheritance mapping type. |
final int | SINGLE_TABLE means the class will be persisted according to the rules of Single Table Inheritance. |
final int | INHERITANCE_TYPE_TABLE_PER_CLASS TABLE_PER_CLASS means the class will be persisted according to the rules of Concrete Table Inheritance. |
array | READ-ONLY: The association mappings of this class. |
integer | READ-ONLY: The policy used for change-tracking on entities of this class. |
array | READ-ONLY: A map of field names to column names. |
string | The name of the custom repository class used for the entity class. |
array | READ-ONLY: The definition of the descriminator column used in JOINED and SINGLE_TABLE inheritance mappings. |
mixed | READ-ONLY: The discriminator map of all mapped classes in the hierarchy. |
mixed | READ-ONLY: The discriminator value of this class. |
array | READ-ONLY: The field mappings of the class. |
array | READ-ONLY: An array of field names. |
string | READ-ONLY: The Id generator type used by the class. |
AbstractIdGenerator | READ-ONLY: The ID generator used for generating IDs for this class. |
array | READ-ONLY: The field names of all fields that are part of the identifier/primary key of the mapped entity class. |
integer | READ-ONLY: The inheritance mapping type used by the class. |
boolean | READ-ONLY: Flag indicating whether the identifier/primary key of the class is composite. |
boolean | READ-ONLY: Whether this class describes the mapping of a mapped superclass. |
boolean $isVersioned | READ-ONLY: A flag for whether or not instances of this class are to be versioned with optimistic locking. |
array | READ-ONLY: The registered lifecycle callbacks for entities of this class. |
mixed | READ-ONLY: The name of the entity class. |
string | READ-ONLY: The namespace the entity class is contained in. |
array | READ-ONLY: The names of the parent classes (ancestors). |
string | READ-ONLY: The name of the entity class that is at the root of the mapped entity inheritance hierarchy. |
array | READ-ONLY: The definition of the sequence generator of this class. |
array | READ-ONLY: The names of all subclasses (descendants). |
array | READ-ONLY: The primary table definition. |
array | READ-ONLY: The definition of the table generator of this class. |
mixed $versionField | READ-ONLY: The name of the field which is used for versioning in optimistic locking (if any). |
Constructor Summary | |
---|---|
ClassMetadataInfo(string entityName) Initializes a new ClassMetadata instance that will hold the object-relational mapping metadata of the class with the given name. |
Method Summary | |
---|---|
void | addInheritedAssociationMapping(AssociationMapping mapping, string owningClassName) INTERNAL: Adds an association mapping without completing/validating it. |
void | addInheritedFieldMapping(mixed fieldMapping, array mapping) INTERNAL: Adds a field mapping without completing/validating it. |
void | addLifecycleCallback(string callback, string event) Adds a lifecycle callback for entities of this class. |
Doctrine\ORM\Mapping\AssociationMapping | getAssociationMapping(string fieldName) Gets the mapping of an association. |
array | Gets all association mappings of the class. |
string | getColumnName(string fieldName) Gets a column name for a field name. |
array | getColumnNames(mixed fieldNames) Gets an array containing all the column names. |
array | getFieldMapping(string fieldName) Gets the mapping of a (regular) field that holds some data but not a reference to another object. |
string | getFieldName(string columnName) Gets the field name for a column name. |
array | Returns an array with all the identifier column names. |
mixed | Gets the identifier (primary key) field names of the class. |
array | getLifecycleCallbacks(string event) Gets the registered lifecycle callbacks for an event. |
string | getSingleIdentifierColumnName() Gets the column name of the single id column. |
string | getSingleIdentifierFieldName() Gets the name of the single id field. |
string | Gets the name of the primary table. |
string | Gets the table name to use for temporary identifier tables of this class. |
Doctrine\DBAL\Types\Type | getTypeOfColumn(mixed columnName) Gets the type of a column. |
Doctrine\DBAL\Types\Type | getTypeOfField(string fieldName) Gets the type of a field. |
boolean | hasAssociation(string fieldName) Checks whether the class has a mapped association with the given field name. |
boolean | hasField(mixed fieldName) Checks whether the class has a (mapped) field with a certain name. |
boolean | hasLifecycleCallbacks(string lifecycleEvent) Whether the class has any attached lifecycle listeners or callbacks for a lifecycle event. |
void | invokeLifecycleCallbacks(mixed lifecycleEvent, Entity entity, string event) Dispatches the lifecycle event of the given entity to the registered lifecycle callbacks and lifecycle listeners. |
boolean | isChangeTrackingDeferredExplicit() Whether the change tracking policy of this class is "deferred explicit". |
boolean | isChangeTrackingDeferredImplicit() Whether the change tracking policy of this class is "deferred implicit". |
boolean | Whether the change tracking policy of this class is "notify". |
boolean | isCollectionValuedAssociation(string fieldName) Checks whether the class has a mapped association for the specified field and if yes, checks whether it is a collection-valued association (to-many). |
boolean | Checks whether the class uses an identity column for the Id generation. |
boolean | Checks whether the class uses a sequence for id generation. |
boolean | Checks whether the class uses a table for id generation. |
boolean | isIdentifier(string fieldName) Checks whether a field is part of the identifier/primary key field(s). |
boolean | Checks whether the class has a natural identifier/pk (which means it does not use any Id generator. |
boolean | Checks whether the mapped class uses the JOINED inheritance mapping strategy. |
boolean | |
boolean | isInheritanceTypeSingleTable() Checks whether the mapped class uses the SINGLE_TABLE inheritance mapping strategy. |
boolean | isInheritanceTypeTablePerClass() Checks whether the mapped class uses the TABLE_PER_CLASS inheritance mapping strategy. |
boolean | isInheritedAssociation(string fieldName) Checks whether a mapped association field is inherited from a superclass. |
boolean | isInheritedField(mixed fieldName) Checks whether a mapped field is inherited from an entity superclass. |
boolean | isNullable(string fieldName) Check if the field is not null. |
boolean | isSingleValuedAssociation(string fieldName) Checks whether the class has a mapped association for the specified field and if yes, checks whether it is a single-valued association (to-one). |
boolean | isUniqueField(string fieldName) Check if the field is unique. |
void | mapField(array mapping) Adds a mapped field to the class. |
void | mapManyToMany(array mapping) Adds a many-to-many mapping. |
void | mapManyToOne(array mapping) Adds a many-to-one mapping. |
void | mapOneToMany(array mapping) Adds a one-to-many mapping. |
void | mapOneToOne(array mapping) Adds a one-to-one mapping. |
void | setChangeTrackingPolicy(integer policy) Sets the change tracking policy used by this class. |
void | setCustomRepositoryClass(mixed repositoryClassName, string mapperClassName) Registers a custom repository class for the entity class. |
void | setDiscriminatorColumn(array columnDef) Sets the discriminator column definition. |
void | setDiscriminatorMap(array map) Sets the discriminator values used by this class. |
void | setIdGenerator(AbstractIdGenerator generator) Sets the ID generator used to generate IDs for instances of this class. |
void | setIdGeneratorType(mixed generatorType) Sets the type of Id generator to use for the mapped class. |
void | setIdentifier(array identifier) INTERNAL: Sets the mapped identifier/primary key fields of this class. |
void | setInheritanceType(integer type) Sets the inheritance type used by the class and it's subclasses. |
void | setLifecycleCallbacks(array callbacks) Sets the lifecycle callbacks for entities of this class. |
void | setParentClasses(mixed classNames) Sets the parent class names. |
void | setPrimaryTable(array primaryTableDefinition) Sets the primary table definition. |
void | setSequenceGeneratorDefinition(array definition) Sets the definition of the sequence ID generator for this class. |
void | setSubclasses(array subclasses) Sets the mapped subclasses of this class. |
void | setTableName(string tableName) Sets the name of the primary table the class is mapped to. |
void | setVersionField(string versionField) Sets the name of the field that is to be used for versioning if this class is versioned for optimistic locking. |
void | setVersionMapping(array mapping) Sets the version field mapping used for versioning. |
void | setVersioned(boolean bool) Sets whether this class is to be versioned for optimistic locking. |
boolean | Checks whether the mapped class uses an Id generator. |
public final int 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).
public final int 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.
This is the default change tracking policy.
public final int CHANGETRACKING_NOTIFY = 3
NOTIFY means that Doctrine relies on the entities sending out notifications when their properties change. Such entity classes must implement the NotifyPropertyChanged interface.
public final int GENERATOR_TYPE_AUTO = 1
AUTO means the generator type will depend on what the used platform prefers. Offers full portability.
public final int 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.
public final int 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.
public final int 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.
public final int GENERATOR_TYPE_TABLE = 3
TABLE means a separate table is used for id generation. Offers full portability.
public final int INHERITANCE_TYPE_JOINED = 2
JOINED means the class will be persisted according to the rules of Class Table Inheritance.
public final int INHERITANCE_TYPE_NONE = 1
NONE means the class does not participate in an inheritance hierarchy and therefore does not need an inheritance mapping type.
public final int INHERITANCE_TYPE_SINGLE_TABLE = 3
SINGLE_TABLE means the class will be persisted according to the rules of Single Table Inheritance.
public final int INHERITANCE_TYPE_TABLE_PER_CLASS = 4
TABLE_PER_CLASS means the class will be persisted according to the rules of Concrete Table Inheritance.
public array $associationMappings = array()
READ-ONLY: The association mappings of this class.
public integer $changeTrackingPolicy = self::CHANGETRACKING_DEFERRED_IMPLICIT
READ-ONLY: The policy used for change-tracking on entities of this class.
public array $columnNames = array()
READ-ONLY: A map of field names to column names. Keys are field names and values column names. Used to look up column names from field names. This is the reverse lookup map of $_fieldNames.
public string $customRepositoryClassName
The name of the custom repository class used for the entity class. (Optional).
public array $discriminatorColumn
READ-ONLY: The definition of the descriminator column used in JOINED and SINGLE_TABLE inheritance mappings.
public mixed $discriminatorMap = array()
READ-ONLY: The discriminator map of all mapped classes in the hierarchy.
This does only apply to the JOINED and SINGLE_TABLE inheritance mapping strategies where a discriminator column is used.
public mixed $discriminatorValue
READ-ONLY: The discriminator value of this class.
This does only apply to the JOINED and SINGLE_TABLE inheritance mapping strategies where a discriminator column is used.
public array $fieldMappings = array()
READ-ONLY: The field mappings of the class. 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.
- 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 (string, optional, schema-only) Whether a unique constraint should be generated for the column.
public array $fieldNames = array()
READ-ONLY: An array of field names. Used to look up field names from column names. Keys are column names and values are field names. This is the reverse lookup map of $_columnNames.
public string $generatorType = self::GENERATOR_TYPE_NONE
READ-ONLY: The Id generator type used by the class.
public AbstractIdGenerator $idGenerator
READ-ONLY: The ID generator used for generating IDs for this class.
public array $identifier = array()
READ-ONLY: The field names of all fields that are part of the identifier/primary key of the mapped entity class.
public integer $inheritanceType = self::INHERITANCE_TYPE_NONE
READ-ONLY: The inheritance mapping type used by the class.
public boolean $isIdentifierComposite = false
READ-ONLY: Flag indicating whether the identifier/primary key of the class is composite.
public boolean $isMappedSuperclass = false
READ-ONLY: Whether this class describes the mapping of a mapped superclass.
public boolean $isVersioned $isVersioned
READ-ONLY: A flag for whether or not instances of this class are to be versioned with optimistic locking.
public array $lifecycleCallbacks = array()
READ-ONLY: The registered lifecycle callbacks for entities of this class.
public mixed $name
READ-ONLY: The name of the entity class.
public string $namespace
READ-ONLY: The namespace the entity class is contained in.
public array $parentClasses = array()
READ-ONLY: The names of the parent classes (ancestors).
public string $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 $entityName
.
public array $sequenceGeneratorDefinition
READ-ONLY: The definition of the sequence generator of this class. Only used for the SEQUENCE generation strategy.
The definition has the following structure:
array(
'sequenceName' => 'name',
'allocationSize' => 20,
'initialValue' => 1
)
public array $subClasses = array()
READ-ONLY: The names of all subclasses (descendants).
public array $table
READ-ONLY: The primary table definition. The definition is an array with the following entries:
name =>
public array $tableGeneratorDefinition
READ-ONLY: The definition of the table generator of this class. Only used for the TABLE generation strategy.
public mixed $versionField $versionField
READ-ONLY: The name of the field which is used for versioning in optimistic locking (if any).
public ClassMetadataInfo(string entityName)
Initializes a new ClassMetadata instance that will hold the object-relational mapping metadata of the class with the given name.
public void addInheritedAssociationMapping(AssociationMapping mapping, string owningClassName)
INTERNAL: Adds an association mapping without completing/validating it. This is mainly used to add inherited association mappings to derived classes.
public void addInheritedFieldMapping(mixed fieldMapping, array mapping)
INTERNAL: Adds a field mapping without completing/validating it. This is mainly used to add inherited field mappings to derived classes.
public void addLifecycleCallback(string callback, string event)
Adds a lifecycle callback for entities of this class.
Note: If the same callback is registered more than once, the old one will be overridden.
public Doctrine\ORM\Mapping\AssociationMapping getAssociationMapping(string fieldName)
Gets the mapping of an association.
public array getAssociationMappings()
Gets all association mappings of the class.
public string getColumnName(string fieldName)
Gets a column name for a field name. If the column name for the field cannot be found, the given field name is returned.
public array getColumnNames(mixed fieldNames)
Gets an array containing all the column names.
public array getFieldMapping(string fieldName)
Gets the mapping of a (regular) field that holds some data but not a reference to another object.
public string getFieldName(string columnName)
Gets the field name for a column name. If no field name can be found the column name is returned.
public array getIdentifierColumnNames()
Returns an array with all the identifier column names.
public mixed getIdentifierFieldNames()
Gets the identifier (primary key) field names of the class.
public array getLifecycleCallbacks(string event)
Gets the registered lifecycle callbacks for an event.
public string getSingleIdentifierColumnName()
Gets the column name of the single id column. Note that this only works on entity classes that have a single-field pk.
public string getSingleIdentifierFieldName()
Gets the name of the single id field. Note that this only works on entity classes that have a single-field pk.
public string getTableName()
Gets the name of the primary table.
public string getTemporaryIdTableName()
Gets the table name to use for temporary identifier tables of this class.
public Doctrine\DBAL\Types\Type getTypeOfColumn(mixed columnName)
Gets the type of a column.
public Doctrine\DBAL\Types\Type getTypeOfField(string fieldName)
Gets the type of a field.
public boolean hasAssociation(string fieldName)
Checks whether the class has a mapped association with the given field name.
public boolean hasField(mixed fieldName)
Checks whether the class has a (mapped) field with a certain name.
public boolean hasLifecycleCallbacks(string lifecycleEvent)
Whether the class has any attached lifecycle listeners or callbacks for a lifecycle event.
public void invokeLifecycleCallbacks(mixed lifecycleEvent, Entity entity, string event)
Dispatches the lifecycle event of the given entity to the registered lifecycle callbacks and lifecycle listeners.
public boolean isChangeTrackingDeferredExplicit()
Whether the change tracking policy of this class is "deferred explicit".
public boolean isChangeTrackingDeferredImplicit()
Whether the change tracking policy of this class is "deferred implicit".
public boolean isChangeTrackingNotify()
Whether the change tracking policy of this class is "notify".
public boolean isCollectionValuedAssociation(string fieldName)
Checks whether the class has a mapped association for the specified field and if yes, checks whether it is a collection-valued association (to-many).
public boolean isIdGeneratorIdentity()
Checks whether the class uses an identity column for the Id generation.
public boolean isIdGeneratorSequence()
Checks whether the class uses a sequence for id generation.
public boolean isIdGeneratorTable()
Checks whether the class uses a table for id generation.
public boolean isIdentifier(string fieldName)
Checks whether a field is part of the identifier/primary key field(s).
public boolean isIdentifierNatural()
Checks whether the class has a natural identifier/pk (which means it does not use any Id generator.
public boolean isInheritanceTypeJoined()
Checks whether the mapped class uses the JOINED inheritance mapping strategy.
public boolean isInheritanceTypeNone()
public boolean isInheritanceTypeSingleTable()
Checks whether the mapped class uses the SINGLE_TABLE inheritance mapping strategy.
public boolean isInheritanceTypeTablePerClass()
Checks whether the mapped class uses the TABLE_PER_CLASS inheritance mapping strategy.
public boolean isInheritedAssociation(string fieldName)
Checks whether a mapped association field is inherited from a superclass.
public boolean isInheritedField(mixed fieldName)
Checks whether a mapped field is inherited from an entity superclass.
public boolean isNullable(string fieldName)
Check if the field is not null.
public boolean isSingleValuedAssociation(string fieldName)
Checks whether the class has a mapped association for the specified field and if yes, checks whether it is a single-valued association (to-one).
public boolean isUniqueField(string fieldName)
Check if the field is unique.
public void mapField(array mapping)
Adds a mapped field to the class.
public void mapManyToMany(array mapping)
Adds a many-to-many mapping.
public void mapManyToOne(array mapping)
Adds a many-to-one mapping.
public void mapOneToMany(array mapping)
Adds a one-to-many mapping.
public void mapOneToOne(array mapping)
Adds a one-to-one mapping.
public void setChangeTrackingPolicy(integer policy)
Sets the change tracking policy used by this class.
public void setCustomRepositoryClass(mixed repositoryClassName, string mapperClassName)
Registers a custom repository class for the entity class.
public void setDiscriminatorColumn(array columnDef)
Sets the discriminator column definition.
public void setDiscriminatorMap(array map)
Sets the discriminator values used by this class. Used for JOINED and SINGLE_TABLE inheritance mapping strategies.
public void setIdGenerator(AbstractIdGenerator generator)
Sets the ID generator used to generate IDs for instances of this class.
public void setIdGeneratorType(mixed generatorType)
Sets the type of Id generator to use for the mapped class.
public void setIdentifier(array identifier)
INTERNAL: Sets the mapped identifier/primary key fields of this class. Mainly used by the ClassMetadataFactory to assign inherited identifiers.
public void setInheritanceType(integer type)
Sets the inheritance type used by the class and it's subclasses.
public void setLifecycleCallbacks(array callbacks)
Sets the lifecycle callbacks for entities of this class. Any previously registered callbacks are overwritten.
public void setParentClasses(mixed classNames)
Sets the parent class names. Assumes that the class names in the passed array are in the order: directParent -> directParentParent -> directParentParentParent ... -> root.
public void setPrimaryTable(array primaryTableDefinition)
Sets the primary table definition. The provided array must have the following structure:
name =>
public void setSequenceGeneratorDefinition(array definition)
Sets the definition of the sequence ID generator for this class.
The definition must have the following structure:
array(
'sequenceName' => 'name',
'allocationSize' => 20,
'initialValue' => 1
)
public void setSubclasses(array subclasses)
Sets the mapped subclasses of this class.
public void setTableName(string tableName)
Sets the name of the primary table the class is mapped to.
public void setVersionField(string versionField)
Sets the name of the field that is to be used for versioning if this class is versioned for optimistic locking.
public void setVersionMapping(array mapping)
Sets the version field mapping used for versioning. Sets the default value to use depending on the column type.
public void setVersioned(boolean bool)
Sets whether this class is to be versioned for optimistic locking.
public boolean usesIdGenerator()
Checks whether the mapped class uses an Id generator.
A ClassMetadata 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.
IMPORTANT NOTE:
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).