Skip to content


DDC-1006: Entity Generator Regenerate If Not New #1591

doctrinebot opened this Issue · 4 comments

2 participants


Jira issue originally created by user sw45859:

When regenerating entities from xml ( and i am sure all others ) it gives a blank entity class when the file exists and the regenerateIfExists is set to true, the expected result would be a full entity with any removed columns removed from the entity and new columns to be added.

i've come up with a fix that i assume is the correct way
i haven't tested this without the regeneration set to true since my application requires the regeneration, here's my code block i'm using:

new \Doctrine\ORM\Mapping\Driver\SesXmlDriver(

$cmf = new Doctrine\ORM\Tools\DisconnectedClassMetadataFactory();
$metadata = $cmf->getAllMetadata();

$generator = new \Doctrine\ORM\Tools\EntityGenerator();
$generator->generate($metadata, 'ext/');

in the *hasProperty and *hasMethod functions, need to add the below to the inline check:

|| ( ! $this->isNew && $this->regenerateEntityIfExists)


Comment created by @beberlei:

blank as in the file is completly empty?


Comment created by sw45859:

no, it generates just the class with no properties or methods.


Comment created by @beberlei:



Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.0.2 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.