Doctrine


Doctrine\ORM\Tools\ClassMetadataReader
/Doctrine/ORM/Tools/ClassMetadataReader.php at line 54

Class ClassMetadataReader

ClassMetadataReader

public class ClassMetadataReader

Class to read metadata mapping information from multiple sources into an array of ClassMetadataInfo instances.

The difference between this class and the ClassMetadataFactory is that this is just a tool for reading in the mapping information from files without having it bound to the actual ORM and the mapping information referenced by the EntityManager. This allows us to read any source of mapping information and return a single array of aggregated ClassMetadataInfo instances.

These arrays are used for exporting the mapping information to the supported mapping drivers, generating entities, generating repositories, etc.

License:
http://www.opensource.org/licenses/lgpl-license.php LGPL
See Also:
www.doctrine-project.org
Since:
2.0
Version:
$Revision$
Author:
Benjamin Eberlei
Guilherme Blanco
Jonathan Wage
Roman Borschel

Method Summary
void

addMappingSource(string source, string type)

Add a new mapping directory to the array of directories to convert and export to another format

array

getMetadatas(bool autoload)

Get an array of ClassMetadataInfo instances for all the configured mapping directories.

static void

registerMappingDriver(string name, string class)

Register a new mapping driver class under a specified name

void

setEntityManager(EntityManager em)

Optionally set the EntityManager instance to get the AnnotationDriver from instead of creating a new instance of the AnnotationDriver

Method Detail

/Doctrine/ORM/Tools/ClassMetadataReader.php at line 139

addMappingSource

public void addMappingSource(string source, string type)

Add a new mapping directory to the array of directories to convert and export to another format

Parameters:
source - The source for the mapping
type - The type of mapping files (yml, xml, etc.)

/Doctrine/ORM/Tools/ClassMetadataReader.php at line 104

getMetadatas

public array getMetadatas(bool autoload)

Get an array of ClassMetadataInfo instances for all the configured mapping directories. Reads the mapping directories and populates ClassMetadataInfo instances.

If you specify $autoload = true then this method will return ClassMetadata instances instead of ClassMetadataInfo instances. Keep in mind that if you specify it to autoload and it doesn't find the class your autoloader may throw an error.

Parameters:
autoload - Whether or to try and autoload the classes
Returns:
$classes

/Doctrine/ORM/Tools/ClassMetadataReader.php at line 74

registerMappingDriver

public static void registerMappingDriver(string name, string class)

Register a new mapping driver class under a specified name


/Doctrine/ORM/Tools/ClassMetadataReader.php at line 86

setEntityManager

public void setEntityManager(EntityManager em)

Optionally set the EntityManager instance to get the AnnotationDriver from instead of creating a new instance of the AnnotationDriver


Doctrine