Skip to content

Commit

Permalink
Merge pull request #891 from spolischook/patch-2
Browse files Browse the repository at this point in the history
Allow to not generate extra use
  • Loading branch information
beberlei committed Dec 30, 2013
2 parents 7360231 + 07f67c5 commit 58c57c5
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/Doctrine/ORM/Tools/EntityGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,7 @@ class EntityGenerator
'<?php
<namespace>
use Doctrine\ORM\Mapping as ORM;
<useStatement>
<entityAnnotation>
<entityClassName>
{
Expand Down Expand Up @@ -380,13 +378,15 @@ public function generateEntityClass(ClassMetadataInfo $metadata)
{
$placeHolders = array(
'<namespace>',
'<useStatement>',
'<entityAnnotation>',
'<entityClassName>',
'<entityBody>'
);

$replacements = array(
$this->generateEntityNamespace($metadata),
$this->generateEntityUse(),
$this->generateEntityDocBlock($metadata),
$this->generateEntityClassName($metadata),
$this->generateEntityBody($metadata)
Expand Down Expand Up @@ -568,6 +568,15 @@ protected function generateEntityNamespace(ClassMetadataInfo $metadata)
return 'namespace ' . $this->getNamespace($metadata) .';';
}
}

protected function generateEntityUse()
{
if ($this->generateAnnotations) {
return "\n".'use Doctrine\ORM\Mapping as ORM;'."\n";
} else {
return "";
}
}

/**
* @param ClassMetadataInfo $metadata
Expand Down

0 comments on commit 58c57c5

Please sign in to comment.