From e295a6d05e37a920843f3151292f901ce0607bfc Mon Sep 17 00:00:00 2001 From: encoder64 Date: Tue, 9 Sep 2014 22:17:10 +0300 Subject: [PATCH] visibility changed && few simple fixes --- .../ORM/Tools/EntityRepositoryGenerator.php | 10 +++------- .../ORM/Tools/EntityRepositoryGeneratorTest.php | 13 ++++++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/Doctrine/ORM/Tools/EntityRepositoryGenerator.php b/lib/Doctrine/ORM/Tools/EntityRepositoryGenerator.php index 4e431b754..f94292afc 100644 --- a/lib/Doctrine/ORM/Tools/EntityRepositoryGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityRepositoryGenerator.php @@ -73,7 +73,7 @@ class extends * * @return string $namespace */ - protected function getClassNamespace($fullClassName) + private function getClassNamespace($fullClassName) { $namespace = substr($fullClassName, 0, strrpos($fullClassName, '\\')); @@ -119,7 +119,7 @@ class extends * * @return string $repositoryName */ - protected function generateEntityRepositoryName($fullClassName) + private function generateEntityRepositoryName($fullClassName) { $namespace = $this->getClassNamespace($fullClassName); @@ -136,7 +136,7 @@ class extends * @param string $fullClassName * @param string $outputDirectory * - * @return string + * @return void */ public function writeEntityRepositoryClass($fullClassName, $outputDirectory) { @@ -152,11 +152,7 @@ class extends if ( ! file_exists($path)) { file_put_contents($path, $code); - - return $path; } - - return null; } /** diff --git a/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php b/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php index dbf5d9796..3a96c8183 100644 --- a/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php @@ -74,7 +74,7 @@ class EntityRepositoryGeneratorTest extends \Doctrine\Tests\OrmTestCase $ns = $this->_namespace; - require_once __DIR__.'/../../Models/DDC3231/DDC3231User1.php'; + require_once __DIR__ . '/../../Models/DDC3231/DDC3231User1.php'; $className = $ns . '\DDC3231User1Tmp'; $this->writeEntityClass('Doctrine\Tests\Models\DDC3231\DDC3231User1', $className); @@ -93,7 +93,7 @@ class EntityRepositoryGeneratorTest extends \Doctrine\Tests\OrmTestCase $this->assertSame('Doctrine\ORM\EntityRepository', $repo->getParentClass()->getName()); - require_once __DIR__.'/../../Models/DDC3231/DDC3231User1NoNamespace.php'; + require_once __DIR__ . '/../../Models/DDC3231/DDC3231User1NoNamespace.php'; $className2 = 'DDC3231User1NoNamespaceTmp'; $this->writeEntityClass('DDC3231User1NoNamespace', $className2); @@ -121,7 +121,7 @@ class EntityRepositoryGeneratorTest extends \Doctrine\Tests\OrmTestCase $ns = $this->_namespace; - require_once __DIR__.'/../../Models/DDC3231/DDC3231User2.php'; + require_once __DIR__ . '/../../Models/DDC3231/DDC3231User2.php'; $className = $ns . '\DDC3231User2Tmp'; $this->writeEntityClass('Doctrine\Tests\Models\DDC3231\DDC3231User2', $className); @@ -140,7 +140,7 @@ class EntityRepositoryGeneratorTest extends \Doctrine\Tests\OrmTestCase $this->assertSame('Doctrine\Tests\Models\DDC3231\DDC3231EntityRepository', $repo->getParentClass()->getName()); - require_once __DIR__.'/../../Models/DDC3231/DDC3231User2NoNamespace.php'; + require_once __DIR__ . '/../../Models/DDC3231/DDC3231User2NoNamespace.php'; $className2 = 'DDC3231User2NoNamespaceTmp'; $this->writeEntityClass('DDC3231User2NoNamespace', $className2); @@ -162,6 +162,7 @@ class EntityRepositoryGeneratorTest extends \Doctrine\Tests\OrmTestCase /** * @param string $className * @param string $newClassName + * @return string */ private function writeEntityClass($className, $newClassName) { @@ -189,7 +190,9 @@ class EntityRepositoryGeneratorTest extends \Doctrine\Tests\OrmTestCase { $this->_repositoryGenerator->setDefaultRepositoryName($defaultRepository); - return $this->_repositoryGenerator->writeEntityRepositoryClass($className . 'Repository', $this->_tmpDir); + $this->_repositoryGenerator->writeEntityRepositoryClass($className . 'Repository', $this->_tmpDir); + + return $this->_tmpDir . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $className) . 'Repository.php'; } }