1
0
mirror of synced 2025-02-20 14:13:15 +03:00

remove whitespace

tabs -> spaces
added class constants
updated phpdoc
This commit is contained in:
Marcel 2012-01-13 11:24:35 +01:00
parent facd64ef2f
commit f26d43b3ea
2 changed files with 20 additions and 11 deletions

View File

@ -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 =
'<?php
@ -150,7 +159,7 @@ public function <methodName>()
{
<spaces><collections>
}
';
';
public function __construct()
{
@ -300,21 +309,21 @@ public function <methodName>()
}
/**
* 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.
*

View File

@ -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()