EntityGenerator
public class EntityGenerator
www.doctrine-project.org
Method Summary | |
---|---|
void | generate(array metadatas, string outputDirectory) Generate and write entity classes for the given array of ClassMetadataInfo instances |
string | generateEntityClass(ClassMetadataInfo metadata) Generate a PHP5 Doctrine 2 entity class from the given ClassMetadataInfo instance |
string | generateUpdatedEntityClass(ClassMetadataInfo metadata, string path) Generate the updated code for the given ClassMetadataInfo and entity at path |
void | setClassToExtend(mixed classToExtend) Set the name of the class the generated classes should extend from |
void | setExtension(string extension) Set the extension to use when writing php files to disk |
void | setGenerateAnnotations(bool bool) Set whether or not to generate annotations for the entity |
void | setGenerateStubMethods(bool bool) Set whether or not to generate stub methods for the entity |
void | setNumSpaces(integer numSpaces) Set the number of spaces the exported class should have |
void | setRegenerateEntityIfExists(bool bool) Set whether or not to regenerate the entity if it exists |
void | setUpdateEntityIfExists(bool bool) Set whether or not to try and update the entity if it already exists |
void | writeEntityClass(ClassMetadataInfo metadata, string outputDirectory) Generated and write entity class to disk for the given ClassMetadataInfo instance |
public void generate(array metadatas, string outputDirectory)
Generate and write entity classes for the given array of ClassMetadataInfo instances
public string generateEntityClass(ClassMetadataInfo metadata)
Generate a PHP5 Doctrine 2 entity class from the given ClassMetadataInfo instance
public string generateUpdatedEntityClass(ClassMetadataInfo metadata, string path)
Generate the updated code for the given ClassMetadataInfo and entity at path
public void setClassToExtend(mixed classToExtend)
Set the name of the class the generated classes should extend from
public void setExtension(string extension)
Set the extension to use when writing php files to disk
public void setGenerateAnnotations(bool bool)
Set whether or not to generate annotations for the entity
public void setGenerateStubMethods(bool bool)
Set whether or not to generate stub methods for the entity
public void setNumSpaces(integer numSpaces)
Set the number of spaces the exported class should have
public void setRegenerateEntityIfExists(bool bool)
Set whether or not to regenerate the entity if it exists
public void setUpdateEntityIfExists(bool bool)
Set whether or not to try and update the entity if it already exists
public void writeEntityClass(ClassMetadataInfo metadata, string outputDirectory)
Generated and write entity class to disk for the given ClassMetadataInfo instance
Generic class used to generate PHP5 entity classes from ClassMetadataInfo instances
[php] $classes = $em->getClassMetadataFactory()->getAllMetadata();
$generator = new \Doctrine\ORM\Tools\EntityGenerator(); $generator->setGenerateAnnotations(true); $generator->setGenerateStubMethods(true); $generator->setRegenerateEntityIfExists(false); $generator->setUpdateEntityIfExists(true); $generator->generate($classes, '/path/to/generate/entities');