Doctrine


Doctrine\ORM\Mapping\ClassMetadata
/Doctrine/ORM/Mapping/ClassMetadata.php at line 42

Class ClassMetadata

Class:ClassMetadata - Superclass: ClassMetadataInfo
ClassMetadataInfo
⌊ ClassMetadata

public class ClassMetadata
extends ClassMetadataInfo

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).

Author:
Roman Borschel
Jonathan H. Wage
Since:
2.0

Field Summary
ReflectionClass

$reflClass

The ReflectionClass instance of the mapped class.

array

$reflFields

The ReflectionProperty instances of the mapped class.

Fields inherited from Doctrine\ORM\Mapping\ClassMetadataInfo
CHANGETRACKING_DEFERRED_EXPLICIT, CHANGETRACKING_DEFERRED_IMPLICIT, CHANGETRACKING_NOTIFY, GENERATOR_TYPE_AUTO, GENERATOR_TYPE_IDENTITY, GENERATOR_TYPE_NONE, GENERATOR_TYPE_SEQUENCE, GENERATOR_TYPE_TABLE, INHERITANCE_TYPE_JOINED, INHERITANCE_TYPE_NONE, INHERITANCE_TYPE_SINGLE_TABLE, INHERITANCE_TYPE_TABLE_PER_CLASS, associationMappings, changeTrackingPolicy, columnNames, customRepositoryClassName, discriminatorColumn, discriminatorMap, discriminatorValue, fieldMappings, fieldNames, generatorType, idGenerator, identifier, inheritanceType, isIdentifierComposite, isMappedSuperclass, isVersioned, lifecycleCallbacks, name, namespace, parentClasses, rootEntityName, sequenceGeneratorDefinition, subClasses, table, tableGeneratorDefinition, versionField
Constructor Summary

ClassMetadata(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

getFieldValue(object entity, string field)

Gets the specified field's value off the given entity.

array

getIdentifierValues(object entity)

Extracts the identifier values of an entity of this class.

string

getQuotedColumnName(string field, AbstractPlatform platform)

Gets the (possibly quoted) column name of a mapped field for safe use in an SQL statement.

string

getQuotedTableName(AbstractPlatform platform)

Gets the (possibly quoted) primary table name of this class for safe use in an SQL statement.

ReflectionClass

getReflectionClass()

Gets the ReflectionClass instance of the mapped class.

array

getReflectionProperties()

Gets the ReflectionPropertys of the mapped class.

ReflectionProperty

getReflectionProperty(string name)

Gets a ReflectionProperty for a specific field of the mapped class.

ReflectionProperty

getSingleIdReflectionProperty()

Gets the ReflectionProperty for the single identifier field.

object

newInstance()

Creates a new instance of the mapped class, without invoking the constructor.

void

setFieldValue(object entity, string field, mixed value)

Sets the specified field to the specified value on the given entity.

void

setIdentifierValues(object entity, mixed id)

Populates the entity identifier of an entity.

Methods inherited from Doctrine\ORM\Mapping\ClassMetadataInfo
addInheritedAssociationMapping, addInheritedFieldMapping, addLifecycleCallback, getAssociationMapping, getAssociationMappings, getColumnName, getColumnNames, getFieldMapping, getFieldName, getIdentifierColumnNames, getIdentifierFieldNames, getLifecycleCallbacks, getSingleIdentifierColumnName, getSingleIdentifierFieldName, getTableName, getTemporaryIdTableName, getTypeOfColumn, getTypeOfField, hasAssociation, hasField, hasLifecycleCallbacks, invokeLifecycleCallbacks, isChangeTrackingDeferredExplicit, isChangeTrackingDeferredImplicit, isChangeTrackingNotify, isCollectionValuedAssociation, isIdGeneratorIdentity, isIdGeneratorSequence, isIdGeneratorTable, isIdentifier, isIdentifierNatural, isInheritanceTypeJoined, isInheritanceTypeNone, isInheritanceTypeSingleTable, isInheritanceTypeTablePerClass, isInheritedAssociation, isInheritedField, isNullable, isSingleValuedAssociation, isUniqueField, mapField, mapManyToMany, mapManyToOne, mapOneToMany, mapOneToOne, setChangeTrackingPolicy, setCustomRepositoryClass, setDiscriminatorColumn, setDiscriminatorMap, setIdGenerator, setIdGeneratorType, setIdentifier, setInheritanceType, setLifecycleCallbacks, setParentClasses, setPrimaryTable, setSequenceGeneratorDefinition, setSubclasses, setTableName, setVersionField, setVersionMapping, setVersioned, usesIdGenerator

Field Detail

/Doctrine/ORM/Mapping/ClassMetadata.php at line 49

reflClass

public ReflectionClass $reflClass

The ReflectionClass instance of the mapped class.


/Doctrine/ORM/Mapping/ClassMetadata.php at line 56

reflFields

public array $reflFields = array()

The ReflectionProperty instances of the mapped class.


Constructor Detail

/Doctrine/ORM/Mapping/ClassMetadata.php at line 71

ClassMetadata

public ClassMetadata(string entityName)

Initializes a new ClassMetadata instance that will hold the object-relational mapping metadata of the class with the given name.

Parameters:
entityName - The name of the entity class the new instance is used for.

Method Detail

/Doctrine/ORM/Mapping/ClassMetadata.php at line 203

getFieldValue

public void getFieldValue(object entity, string field)

Gets the specified field's value off the given entity.


/Doctrine/ORM/Mapping/ClassMetadata.php at line 151

getIdentifierValues

public array getIdentifierValues(object entity)

Extracts the identifier values of an entity of this class.

For composite identifiers, the identifier values are returned as an array with the same order as the field order in identifier.


/Doctrine/ORM/Mapping/ClassMetadata.php at line 233

getQuotedColumnName

public string getQuotedColumnName(string field, AbstractPlatform platform)

Gets the (possibly quoted) column name of a mapped field for safe use in an SQL statement.


/Doctrine/ORM/Mapping/ClassMetadata.php at line 247

getQuotedTableName

public string getQuotedTableName(AbstractPlatform platform)

Gets the (possibly quoted) primary table name of this class for safe use in an SQL statement.


/Doctrine/ORM/Mapping/ClassMetadata.php at line 84

getReflectionClass

public ReflectionClass getReflectionClass()

Gets the ReflectionClass instance of the mapped class.


/Doctrine/ORM/Mapping/ClassMetadata.php at line 94

getReflectionProperties

public array getReflectionProperties()

Gets the ReflectionPropertys of the mapped class.

Returns:
An array of ReflectionProperty instances.

/Doctrine/ORM/Mapping/ClassMetadata.php at line 105

getReflectionProperty

public ReflectionProperty getReflectionProperty(string name)

Gets a ReflectionProperty for a specific field of the mapped class.


/Doctrine/ORM/Mapping/ClassMetadata.php at line 116

getSingleIdReflectionProperty

public ReflectionProperty getSingleIdReflectionProperty()

Gets the ReflectionProperty for the single identifier field.

Throws:
If the class has a composite identifier.

/Doctrine/ORM/Mapping/ClassMetadata.php at line 340

newInstance

public object newInstance()

Creates a new instance of the mapped class, without invoking the constructor.


/Doctrine/ORM/Mapping/ClassMetadata.php at line 192

setFieldValue

public void setFieldValue(object entity, string field, mixed value)

Sets the specified field to the specified value on the given entity.


/Doctrine/ORM/Mapping/ClassMetadata.php at line 174

setIdentifierValues

public void setIdentifierValues(object entity, mixed id)

Populates the entity identifier of an entity.

Todo:
Rename to assignIdentifier()

Doctrine