Pt_BR En Ja De Fr 
You are currently viewing the Development branch api documentation. Switch to 0.11 or 1.0

Development Doctrine_ClassMetadata

Doctrine ClassMetadata

A <tt>ClassMetadata</tt> instance holds all the information (metadata) of an entity and it's associations and how they're mapped to the relational database.

It is the backbone of Doctrine's metadata mapping.

Method Summary

Method Details

  • (boolean) isIdGeneratorSequence()

    Checks whether the class uses a sequence for id generation.

    Doctrine_ClassMetadata


  • (string) lookupFieldName($lcColumnName)

    Looks up the field name for a (lowercased) column name.

    This is mostly used during hydration, because we want to make the conversion to field names while iterating over the result set for best performance. By doing this at that point, we can avoid re-iterating over the data just to convert the column names

    Doctrine_ClassMetadata

    throws Doctrine::ORM::Exceptions::ClassMetadataException If the field name could not be found.


  • mapField($mapping)

    Adds a field mapping.


  • $fieldName The field name

    (boolean) isUniqueField($fieldName)

    Check if the field is unique.

    Doctrine_ClassMetadata


  • $name the name of the option

    (mixed) getOption($name)

    returns the value of given option

    Doctrine_ClassMetadata


  • $name The name under which the query gets registered.
    $query The DQL query.

    addNamedQuery($name, $query)

    Adds a named query.


  • getCustomRepositoryClass()

    Gets the name of the custom repository class used for the entity class.

    Doctrine_ClassMetadata


  • setParentClasses($classNames)

    Sets the parent class names.

    Assumes that the class names in the passed array are in the order: directParent -> directParentParent -> directParentParentParent ... -> root.


  • (array) getColumnNames($fieldNames = null)

    Gets an array containing all the column names.


  • getInheritanceOption($name)

    Gets an inheritance option.


  • (boolean) isIdGeneratorTable()

    Checks whether the class uses a table for id generation.

    Doctrine_ClassMetadata


  • $fieldName The field name

    (boolean) isIdentifierComposite($fieldName)

    Check if the class has a composite identifier.

    Doctrine_ClassMetadata


  • overrideFieldMapping($newMapping)

    Overrides an existant field mapping.

    Used i.e. by Entity classes deriving from another Entity class that acts as a mapped superclass to refine the basic mapping.


  • $alias relation alias

    getRelation($alias, $recursive = true)


  • (array) getOptions()

    getOptions returns all options of this table and the associated values

    Doctrine_ClassMetadata


  • (array) getLifecycleListeners($event)

    Gets the registered lifecycle listeners for an event.


  • $tableName The table name.

    setTableName($tableName)

    Sets the name of the primary table the class is mapped to.


  • mapEmbeddedValue()

    Maps an embedded value object.


  • getRelationParser()


  • (array|boolean) getIndex($index)

    Doctrine_ClassMetadata


  • (string) serialize()

    Serializes the metadata.

    Part of the implementation of the Serializable interface.

    Doctrine_ClassMetadata


  • (mixed) getIdentifierFieldNames()

    Gets the identifier (primary key) field names of the class.


  • bind($args, $type)


  • __toString()


  • (array) getTableOptions()

    getTableOptions returns all table options.

    Doctrine_ClassMetadata


  • (boolean) isIdGeneratorIdentity()

    Checks whether the class uses an identity column for the Id generation.

    Doctrine_ClassMetadata


  • (boolean) usesIdGenerator()

    Checks whether the class uses an Id generator.

    Doctrine_ClassMetadata


  • hasLowerColumn($lcColumnName)


  • getTableName()


  • (array) getIdentifierColumnNames()

    Returns an array with all the identifier column names.


  • getComponentName()


  • (string) getFieldNameForLowerColumnName($lcColumnName)

    Gets the field name for a completely lowercased column name.

    Mainly used during hydration.


  • $alias the relation to check if exists

    (boolean) hasRelation($alias)

    Doctrine_ClassMetadata


  • (integer) getInheritanceType()

    Gets the inheritance type used by the class.


  • addLifecycleListener($listenerClass, $callbacks)

    Adds a lifecycle listener for Entities this class.

    Note: If the same listener class is registered more than once, the old one will be overridden.


  • getInheritedFields()


  • $mapperClassName The class name of the custom mapper.

    setCustomRepositoryClass($repositoryClassName, $mapperClassName)

    Registers a custom mapper for the entity class.


  • $fieldName The field name

    (boolean) isIdentifier($fieldName)

    Checks whether a field is part of the identifier/primary key field(s).

    Doctrine_ClassMetadata


  • setIdGeneratorType($type)


  • $entityName Name of the entity class the metadata info is used for.

    __construct($entityName, ( ) $em)

    Constructs a new ClassMetadata instance.


  • getAttribute($name)


  • mapManyToOne($mapping)


  • $componentName the name of the related component
    $options relation options

    hasMany($componentName, $options)

    hasMany binds One-to-Many / Many-to-Many aggregate relation

    Doctrine_ClassMetadata


  • (string) getRootClassName()

    Gets the name of the root class of the entity hierarchy. If the entity described by the ClassMetadata is not participating in a hierarchy, this is the same as the name returned by .


  • hasAttribute($name)


  • (boolean) isIdentifierNatural()

    Checks whether the class has a natural identifier/pk (which means it does not use any Id generator.


  • $fieldName The field name.

    (array) getFieldMapping($fieldName)

    Gets the mapping of a (regular) fields that holds some data but not a reference to another object.

    Doctrine_ClassMetadata


  • (string) getClassName()

    getComponentName


  • addLifecycleCallback($callback, $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.


  • $subclasses The names of all subclasses.

    setSubclasses($subclasses)

    Sets the subclasses of the class.

    All entity classes that participate in a hierarchy and have subclasses need to declare them this way.


  • setInheritanceType($type, $options = array())

    Sets the inheritance type used by the class and it's subclasses.


  • $componentName the name of the related component
    $options relation options

    hasOne($componentName, $options)

    hasOne binds One-to-One aggregate relation

    Doctrine_ClassMetadata


  • (array) getSubclasses()

    Gets the names of all subclasses.

    Doctrine_ClassMetadata


  • setTableOption($name, $value)

    Sets a table option.


  • (array) getFieldNames()

    Returns an array containing all the field names.


  • (string) getCustomAccessor($fieldName)

    Gets the custom accessor of a field.

    Doctrine_ClassMetadata


  • (array) getFieldMappings()

    Gets all field mappings.


  • isDiscriminatorColumn($columnName)


  • $name the name of the option to set
    $value the value of the option

    (Doctrine_Table) setOption($name, $value)

    setOption sets an option and returns this object in order to allow flexible method chaining

    Doctrine_ClassMetadata


  • (boolean) hasSubclasses()

    Checks whether the class has any persistent subclasses.

    Doctrine_ClassMetadata


  • $columnName column name

    (string) getFieldName($columnName)

    Gets the field name for a column name.

    If no field name can be found the column name is returned.

    Doctrine_ClassMetadata


  • (array) getParentClasses()

    Gets the names of all parent classes.

    Doctrine_ClassMetadata


  • isImmutable()


  • (array) getRelations()

    getRelations returns an array containing all relation objects

    Doctrine_ClassMetadata


  • (array) getExportableFormat($parseForeignKeys = true)

    getExportableFormat Returns an array with all the information needed to create the main database table for the class.


  • (mixed) getIdentifier()

    Gets the identifier (primary key) field names of the class.


  • (array) getLifecycleCallbacks($event)

    Gets the registered lifecycle callbacks for an event.


  • getConnection()


  • (boolean) export()

    export exports this class to the database based on its mapping.

    Doctrine_ClassMetadata

    throws Doctrine_Connection_Exception If some error other than Doctrine::ERR_ALREADY_EXISTS occurred during the create table operation.


  • $entity The Entity on which the event occured.
    $event The lifecycle event.

    invokeLifecycleCallbacks($lifecycleEvent, ( ) $entity, $event)

    Dispatches the lifecycle event of the given Entity to the registered lifecycle callbacks and lifecycle listeners.


  • (array) getAssociationMappings()

    Gets all association mappings of the class.


  • (string) getCustomMutator($fieldName)

    Gets the custom mutator of a field.

    Doctrine_ClassMetadata


  • mapOneToMany($mapping)


  • getEntityManager()


  • (boolean) hasParentClasses()

    Checks whether the class has any persistent parent classes.

    Doctrine_ClassMetadata


  • bindToEntityManager($emName)

    Binds the entity instance of this class to a specific EntityManager.


  • (string) getIdGeneratorType()

    Gets the Id generator type used by the class.


  • (string) getTypeOfField($fieldName)

    Gets the type of a field.


  • setIdentifier($identifier)


  • $fieldName The field name

    (boolean) isNotNull($fieldName)

    Check if the field is not null.

    Doctrine_ClassMetadata


  • (string) getSingleIdentifierFieldName()

    Gets the name of the single id field. Note that this only works on entity classes that have a single-field pk.


  • mapManyToMany($mapping)


  • mapOneToOne($mapping)

    Adds a one-to-one association mapping.


  • addIndex($index, $definition)

    adds an index to this table


  • getInheritanceOptions()

    Gets all inheritance options.


  • bindRelation($args, $type)


  • getTableOption($name)

    Gets a table option.


  • setEntityType($type)


  • setInheritanceOption($name, $value)

    Sets an inheritance option.


  • $serialized The serialized metadata class.

    unserialize($serialized)

    Reconstructs the metadata class from it's serialized representation.

    Part of the implementation of the Serializable interface.


  • $alias The field name.

    (string) getColumnName($fieldName, $alias)

    Gets a column name for a field name.

    If the column name for the field cannot be found, the given field name is returned.

    Doctrine_ClassMetadata


  • (mixed) getTypeOfColumn($columnName)

    Doctrine_ClassMetadata


  • (boolean) isInheritedField($fieldName)

    Checks whether a persistent field is inherited from a superclass.

    Doctrine_ClassMetadata


  • (boolean) hasField($fieldName)

    Checks whether the class has a (mapped) field with a certain name.


  • $fieldName The field name that represents the association in the object model.

    (Doctrine::ORM::Mapping::AssociationMapping) getAssociationMapping($fieldName)

    Gets the mapping of an association.

    Doctrine_ClassMetadata


  • setAttribute($name, $value)


  • getFieldLength($fieldName)

    Gets the (maximum) length of a field.


Comments (0) [ add comment ]

 No Comments

Add Comment

Add New Comment
Please enter follow the doctrine