From f26d43b3eadfbd89d95012430256b4e2d3253a3a Mon Sep 17 00:00:00 2001 From: Marcel Date: Fri, 13 Jan 2012 11:24:35 +0100 Subject: [PATCH] remove whitespace tabs -> spaces added class constants updated phpdoc --- lib/Doctrine/ORM/Tools/EntityGenerator.php | 29 ++++++++++++------- .../Tests/ORM/Tools/EntityGeneratorTest.php | 2 +- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index eae008d7f..a3f2a250c 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -47,6 +47,15 @@ use Doctrine\ORM\Mapping\ClassMetadataInfo, */ class EntityGenerator { + /** + * Specifies class fields should be protected + */ + const FIELD_VISIBLE_PROTECTED = 'protected'; + /** + * Specifies class fields should be private + */ + const FIELD_VISIBLE_PRIVATE = 'private'; + /** * @var bool */ @@ -86,8 +95,8 @@ class EntityGenerator /** Whether or not to re-generate entity class if it exists already */ private $_regenerateEntityIfExists = false; - private $_fieldVisibility = 'private'; - + private $_fieldVisibility = 'private'; + private static $_classTemplate = '() { } -'; +'; public function __construct() { @@ -300,21 +309,21 @@ public function () } /** - * Set whether or not to generate annotations for the entity + * Set the class fields visibility for the entity (can either be private or protected) * * @param bool $bool * @return void */ public function setFieldVisibility($visibility) { - if($visibility != 'private' && $visibility != 'protected') - { - throw new \InvalidArgumentException('Invalid provided visibilty (only private and protected are allowed): ' . $visibility); - } - + if($visibility != 'private' && $visibility != 'protected') + { + throw new \InvalidArgumentException('Invalid provided visibilty (only private and protected are allowed): ' . $visibility); + } + $this->_fieldVisibility = $visibility; } - + /** * Set an annotation prefix. * diff --git a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php index 3b6c1a803..f3d84317b 100644 --- a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php @@ -26,7 +26,7 @@ class EntityGeneratorTest extends \Doctrine\Tests\OrmTestCase $this->_generator->setGenerateStubMethods(true); $this->_generator->setRegenerateEntityIfExists(false); $this->_generator->setUpdateEntityIfExists(true); - $this->_generator->setFieldVisibility('protected'); + $this->_generator->setFieldVisibility(EntityGenerator::FIELD_VISIBLE_PROTECTED); } public function tearDown()