Allow to not generate extra use
For case when we not generate annotation (by default at doctrine orm:generate-entities) allow to not generate extra use for it - ```php use Doctrine\ORM\Mapping as ORM; ``` For example if generate entities for my project that use only dbal in pord but use orm for generate entities in dev mode.
This commit is contained in:
parent
7360231b4b
commit
07f67c5d1a
@ -202,9 +202,7 @@ class EntityGenerator
|
|||||||
'<?php
|
'<?php
|
||||||
|
|
||||||
<namespace>
|
<namespace>
|
||||||
|
<useStatement>
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
<entityAnnotation>
|
<entityAnnotation>
|
||||||
<entityClassName>
|
<entityClassName>
|
||||||
{
|
{
|
||||||
@ -380,6 +378,7 @@ public function __construct()
|
|||||||
{
|
{
|
||||||
$placeHolders = array(
|
$placeHolders = array(
|
||||||
'<namespace>',
|
'<namespace>',
|
||||||
|
'<useStatement>',
|
||||||
'<entityAnnotation>',
|
'<entityAnnotation>',
|
||||||
'<entityClassName>',
|
'<entityClassName>',
|
||||||
'<entityBody>'
|
'<entityBody>'
|
||||||
@ -387,6 +386,7 @@ public function __construct()
|
|||||||
|
|
||||||
$replacements = array(
|
$replacements = array(
|
||||||
$this->generateEntityNamespace($metadata),
|
$this->generateEntityNamespace($metadata),
|
||||||
|
$this->generateEntityUse(),
|
||||||
$this->generateEntityDocBlock($metadata),
|
$this->generateEntityDocBlock($metadata),
|
||||||
$this->generateEntityClassName($metadata),
|
$this->generateEntityClassName($metadata),
|
||||||
$this->generateEntityBody($metadata)
|
$this->generateEntityBody($metadata)
|
||||||
@ -568,6 +568,15 @@ public function __construct()
|
|||||||
return 'namespace ' . $this->getNamespace($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
|
* @param ClassMetadataInfo $metadata
|
||||||
|
Loading…
x
Reference in New Issue
Block a user