diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index 616c60a9d..230ab98b9 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -82,7 +82,7 @@ class EntityGenerator private static $_classTemplate = ' + @@ -189,7 +189,6 @@ public function () { $placeHolders = array( '', - '', '', '', '' @@ -197,7 +196,6 @@ public function () $replacements = array( $this->_generateEntityNamespace($metadata), - $this->_generateEntityUse($metadata), $this->_generateEntityDocBlock($metadata), $this->_generateEntityClassName($metadata), $this->_generateEntityBody($metadata) @@ -309,13 +307,6 @@ public function () } } - private function _generateEntityUse(ClassMetadataInfo $metadata) - { - if ($this->_extendsClass()) { - return "\n\nuse " . $this->_getClassToExtendName() . ";\n"; - } - } - private function _generateEntityClassName(ClassMetadataInfo $metadata) { return 'class ' . $this->_getClassName($metadata) . diff --git a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php index ef4f51353..8a5431094 100644 --- a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php @@ -20,6 +20,7 @@ class EntityGeneratorTest extends \Doctrine\Tests\OrmTestCase $this->_generator->setGenerateStubMethods(true); $this->_generator->setRegenerateEntityIfExists(false); $this->_generator->setUpdateEntityIfExists(true); + $this->_generator->setClassToExtend('stdClass'); } public function testWriteEntityClass() @@ -100,6 +101,18 @@ class EntityGeneratorTest extends \Doctrine\Tests\OrmTestCase $this->assertTrue(strstr($code, 'public function getTest(') !== false); $this->assertTrue(strstr($code, 'public function setTest(') !== false); + return $metadata; + } + + /** + * @depends testEntityUpdatingWorks + * @param ClassMetadata $metadata + */ + public function testEntityExtendsStdClass($metadata) + { + $book = new \EntityGeneratorBook(); + $this->assertType('stdClass', $book); + unlink(__DIR__ . '/EntityGeneratorBook.php'); } }