Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProxyFactory: Catch exception if type hint of entity method parameter is invalid #469

Closed
wants to merge 141 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
3e53d9d
Changed commands to use command.name in the help
stof Jul 16, 2012
5b55739
Moved implementation from EntityRepository to EntityManager. This dec…
guilhermeblanco Jul 23, 2012
2389f77
Fixed DefaultRepositoryClassName which should follow the Persistence …
guilhermeblanco Jul 25, 2012
2158a07
[2.3] Use HelperSet in cli-config.php
igorw Jul 26, 2012
ac9df05
Fixed is_subclass_of comparing an interface which brought our require…
guilhermeblanco Jul 26, 2012
369a30a
Added the new DBAL 2.3 types in the EntityGenerator typehint map
stof Jul 27, 2012
bd1e6ac
Merge pull request #410 from igorw/helper-set
beberlei Jul 29, 2012
13d32e6
Merge remote-tracking branch 'origin/2.3' into 2.3
beberlei Jul 29, 2012
ef27721
Merge remote-tracking branch 'origin/2.3' into 2.3
beberlei Jul 29, 2012
dfa6ff6
DDC-1939 - Removing references to non-existing AssociationMapping class
Ocramius Jul 24, 2012
e2c40dc
[DDC-1939] Add test for persistent collection delete with composite key
beberlei Jul 29, 2012
d7bdae3
Merge branch 'DDC-1939' into 2.3
beberlei Jul 29, 2012
e63575e
added failing test for refresh with eager fetching
schmittjoh Jul 26, 2012
7f68347
[DDC-1964] Fix issue with refresh and and object hydrator not setting…
beberlei Jul 29, 2012
7029d37
Merge branch 'DDC-1964' into 2.3
beberlei Jul 29, 2012
1e2eca1
DDC-1933 - Fixing cloning of QueryBuilder and adding related tests
Ocramius Jul 19, 2012
6dd3078
[DDC-1937] Fix bug with apc and annotation caching using a workaround.
beberlei Jul 29, 2012
1676cf2
Merge branch 'DDC-1937' into 2.3
beberlei Jul 29, 2012
c55394c
Bump dependencies
beberlei Jul 29, 2012
5527e12
Release 2.3.0-RC1
beberlei Jul 29, 2012
992b51e
Bump dev version to 2.3.0
beberlei Jul 29, 2012
3b3d762
[DDC-1961] Fixed parameter type support in Parameter
Majkl578 Jul 31, 2012
3f2ddc6
Merge pull request #416 from Majkl578/DDC-1961
guilhermeblanco Jul 31, 2012
c99c7b6
Update EntityRepository and PersistentCollection to new Criteria#expr…
beberlei Aug 1, 2012
17862d9
Merge branch 'CriteriaExpressionBuilder' into 2.3
beberlei Aug 1, 2012
2e6b50b
Create the setCustomHydrationMode function
Aug 14, 2012
af08f05
Fix setCustomHydrationModes + added test
asm89 Aug 14, 2012
971865f
Merge branch 'config' into 2.3
asm89 Aug 14, 2012
3aaa90e
Fix ORMInvalidArgumentException factory methods with return instead o…
chEbba Aug 19, 2012
9d909cd
Fix DDC-1977
FabioBatSilva Aug 15, 2012
48e9434
Merge pull request #427 from chEbba/return-exception
beberlei Aug 29, 2012
131d300
Merge remote-tracking branch 'origin/master' into 2.3
beberlei Aug 29, 2012
f4ba583
[DDC-1918] Fix weird results at the end of paginator when using fetch…
beberlei Aug 29, 2012
8c1d643
Merge remote-tracking branch 'origin/2.3' into 2.3
beberlei Aug 29, 2012
bdb36a7
Merge branch 'DDC-1918' into 2.3
beberlei Aug 29, 2012
114e233
Revert "Merge remote-tracking branch 'origin/master' into 2.3"
beberlei Aug 29, 2012
d181fbc
Release 2.3.0-RC2
beberlei Aug 29, 2012
1a81444
Bump dev version to 2.3.0
beberlei Aug 29, 2012
9308afc
Release 2.3.0-RC2
beberlei Aug 29, 2012
bbf527a
Bump dev version to 2.3.0
beberlei Aug 29, 2012
2597192
Added a failing test for DDC-2003
Josiah Aug 31, 2012
366c6a7
Fixed DDC-2003 using closures to reference the functionality of the c…
Josiah Aug 31, 2012
0dcfabb
Removed the closure keyword as it isn't supported in PHP 5.3
Josiah Aug 31, 2012
c76280b
Fixed formatting issues identified by Stof
Josiah Aug 31, 2012
9cdee12
Refactored the SqlValueVisitor to move all type processing to the ent…
Josiah Aug 31, 2012
30ad1b0
[DDC-2003] Remove unused variable
beberlei Sep 5, 2012
741080d
Merge branch 'DDC-2003' into 2.3
beberlei Sep 5, 2012
8edecfd
Bump DBAL dependency
beberlei Sep 5, 2012
a96bbbb
Release 2.3.0-RC3
beberlei Sep 5, 2012
4d9f24b
Bump dev version to 2.3.0
beberlei Sep 5, 2012
53e164b
Update lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php
Sep 13, 2012
387516f
Merge branch 'DDC-2027' into 2.3
beberlei Sep 17, 2012
0da0d02
remove duplicate code
FabioBatSilva Sep 13, 2012
3fd8392
Merge branch 'DDC-2026' into 2.3
beberlei Sep 17, 2012
85e5398
Several fixes for comments
Powerhamster Sep 6, 2012
d7da012
added missing use statement
Powerhamster Sep 6, 2012
c2b82fa
Merge branch 'DDC-2014' into 2.3
beberlei Sep 17, 2012
44a56e8
Added a failing test case on PersistentCollection::matching() when co…
Sep 7, 2012
18a7fc5
Fixes PersistentCollection::matching() when collection is not initial…
Sep 7, 2012
586aea0
use of assertCount
Sep 7, 2012
2353736
Merge branch 'DDC-2015' into 2.3
beberlei Sep 17, 2012
3294900
Update dependencies
beberlei Sep 17, 2012
75e968b
Adjust MysqlSchemaToolTest to DBAL changes
beberlei Sep 17, 2012
477642a
Release 2.3.0-RC4
beberlei Sep 17, 2012
c610131
Bump dev version to 2.3.0
beberlei Sep 17, 2012
585c9fd
Bump versions
beberlei Sep 20, 2012
b5e19dc
Release 2.3.0
beberlei Sep 20, 2012
ea2b288
Bump dev version to 2.3.1
beberlei Sep 20, 2012
084101e
Fix DDC-2012
FabioBatSilva Sep 30, 2012
04262e2
Merge branch 'DDC-2012' into 2.3
beberlei Oct 3, 2012
c60e652
Fix test case
FabioBatSilva Sep 30, 2012
4109f22
[DDC-2059] Fix column and foreign key interfering with each other dur…
beberlei Oct 5, 2012
518357d
Merge branch 'DDC-2059' into 2.3
beberlei Oct 5, 2012
abd1137
Fixed unique-constraint name in XML Exporter
Sep 26, 2012
825a68b
Merge branch 'DDC-2044' into 2.3
beberlei Oct 5, 2012
8b2c92a
typo fix
goetas Sep 13, 2012
cb0cdde
spaces
goetas Sep 13, 2012
564ec1e
Merge branch 'DDC-2028' into 2.3
beberlei Oct 5, 2012
31ad3de
Catch exception if a type hint of an entity's method parameter is inv…
leonex-cs1 Oct 11, 2012
1988944
fix typo
jakoch Oct 12, 2012
2e5d741
Fixed bug with comment option not being added to column.
okovalov Oct 11, 2012
e8412b8
Merge branch 'DDC-2068' into 2.3
beberlei Oct 12, 2012
26cfbdd
[DDC-2067] Refactor and fix bug in boolean evaluation inside XML Driver.
beberlei Oct 12, 2012
6bad010
Merge branch 'DDC-2067' into 2.3
beberlei Oct 12, 2012
75c8370
nbproject ignoriert
leonex-cs1 Oct 15, 2012
e5bdc42
Set ReflectionException as "previous exception" of the ORMException.
leonex-cs1 Oct 16, 2012
b53c81a
Fix and test for DDC-2073
mnapoli Nov 6, 2012
ef4ff8b
Fix and test for DDC-2073
mnapoli Nov 6, 2012
737e47e
Merge branch 'DDC-2073' into 2.3
beberlei Nov 9, 2012
d64be28
Fix DDC-2121
FabioBatSilva Nov 5, 2012
994917a
Merge branch 'DDC-2121' into 2.3
beberlei Nov 9, 2012
b610855
Fixed errors:
Nov 5, 2012
9b198be
Merge branch 'DDC-2126' into 2.3
beberlei Nov 9, 2012
974f18d
Proposed fix for DDC-1241
nemekzg Nov 5, 2012
6fee945
Merge branch 'DDC-1241' into 2.3
beberlei Nov 9, 2012
bbf092c
Fix for invalid 'double-ON' SQL generation with entity inheritance ty…
gws Nov 5, 2012
2229a5e
Merge branch 'DDC-2123' into 2.3
beberlei Nov 9, 2012
9dbf4d8
Allow 0 id for Entity
jeremymarc Nov 5, 2012
045d058
Compare to null instead of using isset
jeremymarc Nov 5, 2012
653aef2
Merge branch 'DDC-2122' into 2.3
beberlei Nov 9, 2012
461d201
notice is thrown up if no identifier values found
Nov 1, 2012
c6118cb
refactoring getIndividualValue for valid key value
Nov 2, 2012
1627c97
Update lib/Doctrine/ORM/Persisters/BasicEntityPersister.php
Nov 3, 2012
edaab11
Merge branch 'DDC-2115' into 2.3
beberlei Nov 9, 2012
95a85d6
Improve DocBlock annotations of generated entities
lanthaler Nov 2, 2012
612ed2b
Merge branch 'DDC-2116' into 2.3
beberlei Nov 9, 2012
6d35fad
[DDC-2113] Surround WHERE clause with parens if using SQLFilter
Nov 1, 2012
2ce877b
Merge branch 'DDC-2113' into 2.3
beberlei Nov 9, 2012
a3c98b1
check for false as a return value from get_parent_class(), not null
Oct 16, 2012
e4ef9e0
Merge branch 'DDC-2082' into 2.3
beberlei Nov 9, 2012
a1094d3
Prevented "Undefined index" notice when updating
Oct 17, 2012
1618a3e
Added testcase for DDC-2086
Oct 19, 2012
3c944b3
Merge branch 'DDC-2086' into 2.3
beberlei Nov 9, 2012
57db88b
Fix DDC-2069
FabioBatSilva Oct 20, 2012
643ed0b
Merge branch 'DDC-2069' into 2.3
beberlei Nov 9, 2012
a7ed9e6
Fix DDC-2079
FabioBatSilva Oct 20, 2012
8c2009c
Fix typo
FabioBatSilva Oct 20, 2012
c6eb04d
Merge branch 'DDC-2079' into 2.3
beberlei Nov 9, 2012
e7e69da
Update lib/Doctrine/ORM/Tools/Pagination/WhereInWalker.php
Oct 12, 2012
ed11e61
Update lib/Doctrine/ORM/Tools/Pagination/Paginator.php
Oct 12, 2012
4ea7a5d
Modified the WhereInWalkerTest to be compatible with a single InputPa…
Nov 6, 2012
d069875
Merge branch 'DDC-2071' into 2.3
beberlei Nov 12, 2012
8865a5b
The distinct query should replicate the fields in order by clause and…
Sep 18, 2012
006d383
extracted pgsql sql generation into a helper method
Nov 12, 2012
5756021
Merge branch 'DDC-1958' into 2.3
beberlei Nov 12, 2012
01148e5
[DDC-2109] Fix bug with ResolveTargetEntityListener and ManyToMany as…
beberlei Nov 12, 2012
77d060a
Merge branch 'DDC-2109' into 2.3
beberlei Nov 12, 2012
24f74bc
regression fix for left joins (double ON)
fran6co Nov 20, 2012
469bd02
added outer left join
fran6co Nov 22, 2012
1aab5fe
Merge branch 'DDC-2158' into 2.3
beberlei Nov 25, 2012
83943e8
[DDC-2074] Added test for PersistentCollection#clear.
Nov 25, 2012
c90ed73
[DDC-2074] Fixed bug regarding clearing PC's without owner
Nov 25, 2012
a3fea32
Merge branch 'DDC-2074' into 2.3
beberlei Nov 25, 2012
45269fe
Fix DDC-2172
FabioBatSilva Nov 27, 2012
faedbfc
refactoring tests
FabioBatSilva Nov 27, 2012
6e7e4dd
Fix CS
FabioBatSilva Nov 27, 2012
f75c3b5
Merge branch 'DDC-2172' into 2.3
beberlei Nov 27, 2012
8613228
Clarify BC break in DDC-2156
beberlei Nov 27, 2012
287b29a
Merge branch 'DDC-2156' into 2.3
beberlei Nov 27, 2012
2a67b1b
pull changes from upstream
leonex-cs1 Dec 4, 2012
7c8fe87
pull upstream 2.3
leonex-cs1 Dec 4, 2012
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -8,4 +8,5 @@ lib/Doctrine/Common
lib/Doctrine/DBAL
/.settings/
.buildpath
.project
.project
nbproject/
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -14,7 +14,7 @@
"require": {
"php": ">=5.3.2",
"ext-pdo": "*",
"doctrine/dbal": ">=2.3-dev,<2.5-dev",
"doctrine/dbal": "2.3.*",
"symfony/console": "2.*"
},
"suggest": {
Expand All @@ -26,7 +26,7 @@
"bin": ["bin/doctrine", "bin/doctrine.php"],
"extra": {
"branch-alias": {
"dev-master": "2.4.x-dev"
"dev-master": "2.3.x-dev"
}
}
}
9 changes: 6 additions & 3 deletions lib/Doctrine/ORM/AbstractQuery.php
Expand Up @@ -260,9 +260,12 @@ public function processParameterValue($value)
if (is_object($value) && $this->_em->getMetadataFactory()->hasMetadataFor(ClassUtils::getClass($value))) {
$value = $this->_em->getUnitOfWork()->getSingleIdentifierValue($value);

if ($value === null) {
throw ORMInvalidArgumentException::invalidIdentifierBindingEntity();
}
$value = $values[$class->getSingleIdentifierFieldName()];

if (null === $value) {
throw new \InvalidArgumentException(
"Binding entities to query parameters only allowed for entities that have an identifier."
);
}

return $value;
Expand Down
1 change: 1 addition & 0 deletions lib/Doctrine/ORM/EntityRepository.php
Expand Up @@ -27,6 +27,7 @@
use Doctrine\Common\Collections\Selectable;
use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\ExpressionBuilder;

/**
* An EntityRepository serves as a repository for entities with generic as well as
Expand Down
3 changes: 1 addition & 2 deletions lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
Expand Up @@ -1188,7 +1188,7 @@ protected function _validateAndCompleteFieldMapping(array &$mapping)

// Complete fieldName and columnName mapping
if ( ! isset($mapping['columnName'])) {
$mapping['columnName'] = $this->namingStrategy->propertyToColumnName($mapping['fieldName'], $this->name);
$mapping['columnName'] = $this->namingStrategy->propertyToColumnName($mapping['fieldName']);
}

if ($mapping['columnName'][0] === '`') {
Expand Down Expand Up @@ -1465,7 +1465,6 @@ protected function _validateAndCompleteManyToManyMapping(array $mapping)
if ( ! isset($mapping['joinTable']['name'])) {
$mapping['joinTable']['name'] = $this->namingStrategy->joinTableName($mapping['sourceEntity'], $mapping['targetEntity'], $mapping['fieldName']);
}

if ( ! isset($mapping['joinTable']['joinColumns'])) {
$mapping['joinTable']['joinColumns'] = array(array(
'name' => $this->namingStrategy->joinKeyColumnName($mapping['sourceEntity']),
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/DefaultNamingStrategy.php
Expand Up @@ -45,7 +45,7 @@ public function classToTableName($className)
/**
* {@inheritdoc}
*/
public function propertyToColumnName($propertyName, $className = null)
public function propertyToColumnName($propertyName)
{
return $propertyName;
}
Expand Down
3 changes: 1 addition & 2 deletions lib/Doctrine/ORM/Mapping/NamingStrategy.php
Expand Up @@ -42,10 +42,9 @@ function classToTableName($className);
* Return a column name for a property
*
* @param string $propertyName A property
* @param string $className The fully-qualified class name
* @return string A column name
*/
function propertyToColumnName($propertyName, $className = null);
function propertyToColumnName($propertyName);

/**
* Return the default reference column name
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php
Expand Up @@ -80,7 +80,7 @@ public function classToTableName($className)
/**
* {@inheritdoc}
*/
public function propertyToColumnName($propertyName, $className = null)
public function propertyToColumnName($propertyName)
{
return $this->underscore($propertyName);
}
Expand Down
7 changes: 7 additions & 0 deletions lib/Doctrine/ORM/ORMException.php
Expand Up @@ -155,6 +155,13 @@ public static function invalidEntityRepository($className)
return new self("Invalid repository class '".$className."'. It must be a Doctrine\Common\Persistence\ObjectRepository.");
}

public static function invalidEntityParameterTypeHint($entityClassname, $methodName, $paramName, Exception $previous = null)
{
return new self(
"The method '$methodName' of the entity '$entityClassname' has a ".
"parameter '\$$paramName' whose type hint is invalid.", 0, $previous);
}

public static function missingIdentifierField($className, $fieldName)
{
return new self("The identifier $fieldName is missing for a query of " . $className);
Expand Down
9 changes: 6 additions & 3 deletions lib/Doctrine/ORM/Persisters/BasicEntityPersister.php
Expand Up @@ -697,7 +697,7 @@ public function getOwningTable($fieldName)
*/
public function load(array $criteria, $entity = null, $assoc = null, array $hints = array(), $lockMode = 0, $limit = null, array $orderBy = null)
{
$sql = $this->getSelectSQL($criteria, $assoc, $lockMode, $limit, null, $orderBy);
$sql = $this->_getSelectEntitiesSQL($criteria, $assoc, $lockMode, $limit, null, $orderBy);
list($params, $types) = $this->expandParameters($criteria);
$stmt = $this->conn->executeQuery($sql, $params, $types);

Expand Down Expand Up @@ -842,7 +842,6 @@ private function expandCriteriaParameters(Criteria $criteria)
}

$valueVisitor = new SqlValueVisitor();

$valueVisitor->dispatch($expression);

list($values, $types) = $valueVisitor->getParamsAndTypes();
Expand Down Expand Up @@ -1768,7 +1767,11 @@ private function getIndividualValue($value)
if ($this->em->getUnitOfWork()->getEntityState($value) === UnitOfWork::STATE_MANAGED) {
$idValues = $this->em->getUnitOfWork()->getEntityIdentifier($value);

return reset($idValues);
$key = key($idValues);

if (null !== $key){
$value = $idValues[$key];
}
}

$class = $this->em->getClassMetadata(get_class($value));
Expand Down
8 changes: 4 additions & 4 deletions lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php
Expand Up @@ -525,10 +525,10 @@ protected function getInsertColumnList()
$columns[] = $sourceCol;
}
}
} else if ($this->class->name != $this->class->rootEntityName ||
! $this->class->isIdGeneratorIdentity() || $this->class->identifier[0] != $name) {
$columns[] = $this->quoteStrategy->getColumnName($name, $this->class, $this->platform);
$this->columnTypes[$name] = $this->class->fieldMappings[$name]['type'];
} else if ($this->_class->name != $this->_class->rootEntityName ||
! $this->_class->isIdGeneratorIdentity() || $this->_class->identifier[0] != $name) {
$columns[] = $this->quoteStrategy->getColumnName($name, $this->_class, $this->_platform);
$this->_columnTypes[$name] = $this->_class->fieldMappings[$name]['type'];
}
}

Expand Down
14 changes: 9 additions & 5 deletions lib/Doctrine/ORM/Proxy/ProxyFactory.php
Expand Up @@ -229,11 +229,15 @@ private function _generateMethods(ClassMetadata $class)
$argumentString .= ', ';
}

// We need to pick the type hint class too
if (($paramClass = $param->getClass()) !== null) {
$parameterString .= '\\' . $paramClass->getName() . ' ';
} else if ($param->isArray()) {
$parameterString .= 'array ';
try {
// We need to pick the type hint class too
if (($paramClass = $param->getClass()) !== null) {
$parameterString .= '\\' . $paramClass->getName() . ' ';
} else if ($param->isArray()) {
$parameterString .= 'array ';
}
} catch (\ReflectionException $e) {
throw ORMException::invalidEntityParameterTypeHint($class->getName(), $method->getName(), $param->getName(), $e);
}

if ($param->isPassedByReference()) {
Expand Down
2 changes: 0 additions & 2 deletions lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php
Expand Up @@ -78,7 +78,6 @@ public function exportClassMetadata(ClassMetadataInfo $metadata)
$discriminatorColumnXml = $root->addChild('discriminator-column');
$discriminatorColumnXml->addAttribute('name', $metadata->discriminatorColumn['name']);
$discriminatorColumnXml->addAttribute('type', $metadata->discriminatorColumn['type']);

if (isset($metadata->discriminatorColumn['length'])) {
$discriminatorColumnXml->addAttribute('length', $metadata->discriminatorColumn['length']);
}
Expand Down Expand Up @@ -195,7 +194,6 @@ public function exportClassMetadata(ClassMetadataInfo $metadata)
if (isset($field['columnDefinition'])) {
$fieldXml->addAttribute('column-definition', $field['columnDefinition']);
}

if (isset($field['nullable'])) {
$fieldXml->addAttribute('nullable', $field['nullable'] ? 'true' : 'false');
}
Expand Down
12 changes: 0 additions & 12 deletions lib/Doctrine/ORM/Tools/SchemaTool.php
Expand Up @@ -394,18 +394,6 @@ private function gatherColumn($class, array $mapping, Table $table)
unset($mapping['options']['comment']);
}

if (isset($mapping['options']['unsigned'])) {
$options['unsigned'] = $mapping['options']['unsigned'];

unset($mapping['options']['unsigned']);
}

if (isset($mapping['options']['fixed'])) {
$options['fixed'] = $mapping['options']['fixed'];

unset($mapping['options']['fixed']);
}

$options['customSchemaOptions'] = $mapping['options'];
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Version.php
Expand Up @@ -36,7 +36,7 @@ class Version
/**
* Current Doctrine Version
*/
const VERSION = '2.4.0-DEV';
const VERSION = '2.3.1-DEV';

/**
* Compares a Doctrine version with the current one.
Expand Down
1 change: 0 additions & 1 deletion lib/vendor/doctrine-common
Submodule doctrine-common deleted from 30b8ce
2 changes: 1 addition & 1 deletion lib/vendor/doctrine-dbal
Submodule doctrine-dbal updated 41 files
+34 −1 UPGRADE
+1 −1 composer.json
+91 −22 lib/Doctrine/DBAL/Connection.php
+13 −3 lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php
+11 −0 lib/Doctrine/DBAL/DBALException.php
+1 −1 lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
+1 −1 lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
+2 −2 lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
+2 −2 lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
+2 −1 lib/Doctrine/DBAL/Driver/Statement.php
+1 −0 lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php
+256 −129 lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+72 −114 lib/Doctrine/DBAL/Platforms/DB2Platform.php
+113 −27 lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php
+102 −166 lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+108 −137 lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+100 −140 lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
+4 −0 lib/Doctrine/DBAL/Platforms/SQLAzurePlatform.php
+5 −3 lib/Doctrine/DBAL/Platforms/SQLServer2005Platform.php
+11 −9 lib/Doctrine/DBAL/Platforms/SQLServer2008Platform.php
+149 −159 lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
+100 −89 lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
+1 −1 lib/Doctrine/DBAL/Portability/Statement.php
+56 −47 lib/Doctrine/DBAL/SQLParserUtils.php
+5 −1 lib/Doctrine/DBAL/Schema/Constraint.php
+19 −0 lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php
+2 −2 lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
+1 −1 lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizer.php
+13 −3 lib/Doctrine/DBAL/Statement.php
+2 −2 lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php
+8 −0 lib/Doctrine/DBAL/Types/BigIntType.php
+1 −1 lib/Doctrine/DBAL/Types/GuidType.php
+1 −1 lib/Doctrine/DBAL/Version.php
+1 −1 lib/vendor/doctrine-common
+29 −0 tests/Doctrine/Tests/DBAL/ConnectionTest.php
+15 −0 tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
+23 −3 tests/Doctrine/Tests/DBAL/Functional/MasterSlaveConnectionTest.php
+5 −5 tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php
+1 −3 tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
+36 −0 tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php
+1 −2 tests/Doctrine/Tests/TestUtil.php
Expand Up @@ -29,12 +29,12 @@ public function testGetCreateSchemaSql()
$tool = new SchemaTool($this->_em);
$sql = $tool->getCreateSchemaSql($classes);

$this->assertEquals("CREATE TABLE cms_groups (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(50) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB", $sql[0]);
$this->assertEquals("CREATE TABLE cms_users (id INT AUTO_INCREMENT NOT NULL, email_id INT DEFAULT NULL, status VARCHAR(50) DEFAULT NULL, username VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_3AF03EC5F85E0677 (username), UNIQUE INDEX UNIQ_3AF03EC5A832C1C9 (email_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB", $sql[1]);
$this->assertEquals("CREATE TABLE cms_users_groups (user_id INT NOT NULL, group_id INT NOT NULL, INDEX IDX_7EA9409AA76ED395 (user_id), INDEX IDX_7EA9409AFE54D947 (group_id), PRIMARY KEY(user_id, group_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB", $sql[2]);
$this->assertEquals("CREATE TABLE cms_addresses (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, country VARCHAR(50) NOT NULL, zip VARCHAR(50) NOT NULL, city VARCHAR(50) NOT NULL, UNIQUE INDEX UNIQ_ACAC157BA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB", $sql[3]);
$this->assertEquals("CREATE TABLE cms_emails (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(250) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB", $sql[4]);
$this->assertEquals("CREATE TABLE cms_phonenumbers (phonenumber VARCHAR(50) NOT NULL, user_id INT DEFAULT NULL, INDEX IDX_F21F790FA76ED395 (user_id), PRIMARY KEY(phonenumber)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB", $sql[5]);
$this->assertEquals("CREATE TABLE cms_groups (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(50) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[0]);
$this->assertEquals("CREATE TABLE cms_users (id INT AUTO_INCREMENT NOT NULL, email_id INT DEFAULT NULL, status VARCHAR(50) DEFAULT NULL, username VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_3AF03EC5F85E0677 (username), UNIQUE INDEX UNIQ_3AF03EC5A832C1C9 (email_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[1]);
$this->assertEquals("CREATE TABLE cms_users_groups (user_id INT NOT NULL, group_id INT NOT NULL, INDEX IDX_7EA9409AA76ED395 (user_id), INDEX IDX_7EA9409AFE54D947 (group_id), PRIMARY KEY(user_id, group_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[2]);
$this->assertEquals("CREATE TABLE cms_addresses (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, country VARCHAR(50) NOT NULL, zip VARCHAR(50) NOT NULL, city VARCHAR(50) NOT NULL, UNIQUE INDEX UNIQ_ACAC157BA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[3]);
$this->assertEquals("CREATE TABLE cms_emails (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(250) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[4]);
$this->assertEquals("CREATE TABLE cms_phonenumbers (phonenumber VARCHAR(50) NOT NULL, user_id INT DEFAULT NULL, INDEX IDX_F21F790FA76ED395 (user_id), PRIMARY KEY(phonenumber)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[5]);
$this->assertEquals("ALTER TABLE cms_users ADD CONSTRAINT FK_3AF03EC5A832C1C9 FOREIGN KEY (email_id) REFERENCES cms_emails (id)", $sql[6]);
$this->assertEquals("ALTER TABLE cms_users_groups ADD CONSTRAINT FK_7EA9409AA76ED395 FOREIGN KEY (user_id) REFERENCES cms_users (id)", $sql[7]);
$this->assertEquals("ALTER TABLE cms_users_groups ADD CONSTRAINT FK_7EA9409AFE54D947 FOREIGN KEY (group_id) REFERENCES cms_groups (id)", $sql[8]);
Expand All @@ -54,7 +54,7 @@ public function testGetCreateSchemaSql2()
$sql = $tool->getCreateSchemaSql($classes);

$this->assertEquals(1, count($sql));
$this->assertEquals("CREATE TABLE decimal_model (id INT AUTO_INCREMENT NOT NULL, `decimal` NUMERIC(5, 2) NOT NULL, `high_scale` NUMERIC(14, 4) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB", $sql[0]);
$this->assertEquals("CREATE TABLE decimal_model (id INT AUTO_INCREMENT NOT NULL, `decimal` NUMERIC(5, 2) NOT NULL, `high_scale` NUMERIC(14, 4) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[0]);
}

public function testGetCreateSchemaSql3()
Expand All @@ -67,7 +67,7 @@ public function testGetCreateSchemaSql3()
$sql = $tool->getCreateSchemaSql($classes);

$this->assertEquals(1, count($sql));
$this->assertEquals("CREATE TABLE boolean_model (id INT AUTO_INCREMENT NOT NULL, booleanField TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB", $sql[0]);
$this->assertEquals("CREATE TABLE boolean_model (id INT AUTO_INCREMENT NOT NULL, booleanField TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[0]);
}

/**
Expand Down