Compare commits

...

62 Commits

Author SHA1 Message Date
Benjamin Eberlei 5aedac1e5c Release 2.4.8 2015-08-31 15:19:01 +02:00
Benjamin Eberlei caf30b889b [DCOM-293] Fix security misconfiguration vulnerability allowing local remote arbitrary code execution. 2015-08-31 15:18:15 +02:00
Marco Pivetta 0cf7e0e628 Merge branch 'hotfix/#1352-entity-generator-new-class-metadata-hotfix-2.4' into 2.4
Close #1352
2015-03-31 08:45:37 +01:00
Fedik 2290d1ff9b fix EntityGenerator RegenerateEntityIfExists 2015-03-31 08:45:07 +01:00
Jonathan H. Wage ecb1e1060a Update docs theme submodule. 2015-03-23 22:22:04 +00:00
Marco Pivetta 9dfa20d3af Merge branch 'hotfix/#1327-entity-generator-default-property-value-export-2.4' into 2.4 2015-03-17 22:48:41 +00:00
Jeremy 33baa41e9f Properly generate default value from yml & xml mapping 2015-03-17 22:48:23 +00:00
Marco Pivetta 1c8f9ca1cc Merge branch 'hotfix/#1338-identity-map-garbage-collection-prevention-on-canceled-remove-2.4' into 2.4 2015-03-17 22:42:48 +00:00
Marco Pivetta 7aa33c6a15 #1338 - Removing redundant test case 2015-03-17 22:41:52 +00:00
Marco Pivetta 0fc476d068 Adding @group annotations for newly introduced tests 2015-03-17 22:41:42 +00:00
Marco Pivetta 1e38d7d07e #1338 DDC-3619 - moved test to unit of work tests 2015-03-17 22:40:21 +00:00
nclavaud bac6570af1 Update identityMap when entity gets managed again
http://www.doctrine-project.org/jira/browse/DDC-3619

When using SoftDeleteable doctrine extension, an entity can be scheduled
for deletion, then persisted before flushing. In such a case, the entity
was removed from the unit of work identity map and no reference was
hold. This could lead to spl_object_hash collisions, and prevent
another, new entity to be persisted later.

This fix makes sure the unit of work identity map holds a reference to
the entity after it has been soft-deleted.
2015-03-17 22:38:57 +00:00
Marco Pivetta 18c873216b Merge pull request #1300 from Ocramius/hotfix/#1169-DDC-3343-one-to-many-persister-deletes-only-on-extra-lazy-plus-orphan-removal-2.4
[2.4] #1169 DDC-3343 one-to-omany persister deletes only on EXTRA_LAZY plus orphanRemoval
2015-02-16 00:29:00 +00:00
Marco Pivetta 11936a6cac #1169 DDC-3343 - correcting functional test case cleanup logic (sorting deletes by FK dependencies) 2015-02-05 00:53:34 +00:00
Marco Pivetta f5705d6d95 #1169 DDC-3343 - corrected persister logic - only uses the entity persister to perform deletes on the owning side 2015-02-05 00:52:54 +00:00
Marco Pivetta a1bd3e8cc9 #1169 DDC-3343 - optimized imports 2015-02-05 00:25:20 +00:00
Marco Pivetta 2fa48c6e88 #1169 DDC-3343 - actually deleting associated elements when they are orphaned and EXTRA_LAZY is used 2015-02-05 00:25:06 +00:00
Marco Pivetta c4ab4db743 #1169 DDC-3343 - remove duplicate tests introduced by cherry-picking conflicts 2015-02-05 00:23:51 +00:00
Marco Pivetta c6e7a81849 #1169 DDC-3343 - removing duplicate test method 2015-02-05 00:21:28 +00:00
Marco Pivetta 4bed15b984 #1169 DDC-3343 - one-to-many persister should only interact with the data when orphanRemoval and EXTRA_LAZY are combined 2015-02-05 00:20:39 +00:00
Marco Pivetta 4884183b95 #1169 DDC-3343 - fixing test case typos (referencing wrong/inexisting properties, inexisting owning side assigned 2015-02-05 00:16:58 +00:00
Marco Pivetta fac410b213 #1169 DDC-3343 - aligning test suite logic to the 2.5 branch (failing tests) 2015-02-05 00:16:07 +00:00
Marco Pivetta cbe5575f38 #1169 DDC-3343 - adding tests for orphan-removal + extra-lazy + one-to-many element removal behavior 2015-02-05 00:15:18 +00:00
Marco Pivetta 94c0e46c96 #1169 DDC-3343 - updating test expectations - one-to-many changes should be no-op unless orphan removal is specified. 2015-02-05 00:14:19 +00:00
Marco Pivetta af59ea962f #1169 DDC-3343 - updating test expectations - one-to-many changes should be no-op unless orphan removal is specified. 2015-02-05 00:14:11 +00:00
Marco Pivetta e05930e714 Merge branch 'hotfix/#1294-avoid-connection-with-detached-metadata-backport-to-2.4' into 2.4 2015-02-04 23:46:22 +00:00
Marco Pivetta db06355b63 #1294 - fixing differences between 2.5 and 2.4 fixes (reverts DBAL dependency bump) 2015-02-04 23:46:15 +00:00
Ryan Weaver 2e9ffe831c Adding docblock 2015-02-04 23:37:11 +00:00
Ryan Weaver 9d7256aace Small code change thanks to the comments and adding a test 2015-02-04 23:37:03 +00:00
Ryan Weaver 52b3e21969 Only getting the target platform when it's *actually* needed to avoid errors
initialize() is called sometimes, even when the following code doesn't need
the targetPlatform property. Specifically, in AbstractClassMetadataFactory::getAllMetadata().

But as of DBAL 2.5.0, calling Connection::getDatabasePlatform() will make a
connection to the database, which means that sometimes it may fail (e.g. you
haven't configured your database yet). As a result, calling a method like
AbstractClassMetadataFactory::getAllMetadata() - which does not need the
targetPlatform - will fail, because determining the targetPlatform requires
a connection, which fails.

This avoids that - we only get the targetPlatform *when* we need it, which
are cases where we're doing things that do indeed need a connection.
2015-02-04 23:35:02 +00:00
Marco Pivetta 97afe00d0f Merge pull request #1282 from Ocramius/hotfix/#1169-extra-lazy-one-to-many-should-not-delete-referenced-entities-2.4
Hotfix/#1169 extra lazy one to many should not delete referenced entities (backport to 2.4)
2015-01-25 05:44:14 +01:00
Marco Pivetta 51250e987e #1169 DDC-3343 - moved tests to correct test class 2015-01-24 12:51:19 +01:00
Marco Pivetta c4b59b4eb0 #1169 DDC-3343 - adapting patch to 2.4 branch 2015-01-24 12:50:10 +01:00
Marco Pivetta daca81861c #1169 DDC-3343 - additional test cases: removing proxies from an extra-lazy collection still updates the owning side values 2015-01-24 12:38:51 +01:00
Marco Pivetta 52fbe35bc7 #1169 DDC-3343 - correcting query count assertions on extra-lazy specific tests (some DELETE operations became UPDATE operations)
Conflicts:
	lib/Doctrine/ORM/Persisters/Collection/OneToManyPersister.php
	tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php
2015-01-24 12:38:44 +01:00
Marco Pivetta 50ac97e72d #1169 DDC-3343 - removing duplicate test 2015-01-24 12:37:41 +01:00
Marco Pivetta cfed92a5cf #1169 DDC-3343 - integrating tests into the existing test suite
Conflicts:
	tests/Doctrine/Tests/ORM/Functional/ValueConversionType/OneToManyExtraLazyTest.php
2015-01-24 12:37:21 +01:00
Marco Pivetta d69fd91454 #1169 DDC-3343 - importing used classe 2015-01-24 12:36:18 +01:00
Marco Pivetta 41258deed7 #1169 DDC-3343 - optimized imports 2015-01-24 12:36:10 +01:00
Marco Pivetta 193ec51607 #1169 DDC-3343 - refactoring test to use pre-existing test models 2015-01-24 12:36:01 +01:00
Marco Pivetta 7292920b15 #1169 DDC-3343 - refactoring test to use pre-existing test models 2015-01-24 12:35:50 +01:00
Marco Pivetta 24ebfb69cb #1169 DDC-3343 - minor refactoring: constant over string reference 2015-01-24 12:34:10 +01:00
Marco Pivetta ff0168834e Conflicts:
lib/Doctrine/ORM/Persisters/Collection/OneToManyPersister.php
2015-01-24 12:33:52 +01:00
Andrea Sprega a88550a70c [DDC-3343] Failing test case (updated) 2015-01-24 12:32:30 +01:00
Andrea Sprega ee246af7e3 [DDC-3343] Failing test case 2015-01-24 12:32:17 +01:00
Marco Pivetta ba04c9801d Merge pull request #1276 from TomasVotruba/travis-coverage-speedup
[2.4] travis: run coverage just once
2015-01-22 15:03:10 +01:00
Tomas Votruba 5d637af056 travis: run coverage just once 2015-01-22 13:46:29 +01:00
Marco Pivetta ec84953af4 Merge pull request #1266 from Ocramius/hotfix/fix-schema-generation-in-tests-on-pgsql
[2.4] Fix schema generation in the test suite
2015-01-22 12:30:16 +01:00
Marco Pivetta 56c5cb41fc DDC-3518 - Schema creation statement is not quoted 2015-01-18 17:39:10 +01:00
Guilherme Blanco e0077b290b ORM side fixes. 2015-01-18 17:09:29 +01:00
Marco Pivetta ee9aebf569 #1254 DDC-3500 - fixed duplicate JOIN aliases in CTI + WITH condition joins 2015-01-18 16:43:31 +01:00
Marco Pivetta 91e5c0d443 Merge pull request #1231 from aivus/2.4-DDC-1590-backport
Backport 'Merge pull request #1098 from encoder32/DDC-1590' to 2.4 branch
2015-01-17 22:19:29 +01:00
Marco Pivetta 05342b0b94 Merge pull request #1254 from vitaliyberdylo/2.4
Fix applying ON/WITH conditions to first join in Class Table Inheritance
2015-01-17 21:56:32 +01:00
Marco Pivetta 8198a6ce7e Merge branch 'hotfix/#1250-DDC-3493-fix-class-pseudo-constant-parsing-in-entitygenerator-2.4-backport' into 2.4 2015-01-15 04:20:39 +01:00
Andrea Sprega b5e40fe5f5 DDC-3493 - fixed EntityGenerator parsing for php 5.5 "::class" syntax 2015-01-15 04:20:16 +01:00
lukasmaz ddf3125afe Test case for "class" keyword
Test case for http://www.doctrine-project.org/jira/browse/DDC-3493
2015-01-15 04:19:54 +01:00
Strate 8d33ccced1 Fix applying ON/WITH conditions to first join in Class Table Inheritance
Now we build nested joins for CTI when using ON/WITH clause.
2015-01-14 19:55:54 +02:00
Marco Pivetta b11ae45a2f Merge branch 'hotfix/#1242-lock-uninitialized-proxies' into 2.4
Close #1242
2015-01-13 02:36:08 +01:00
Carnage d3112bf119 Fixed issue 2015-01-13 02:35:50 +01:00
Carnage 4e4637de2e Added test to demonstrate issue 2015-01-13 02:35:44 +01:00
Marco Pivetta 4c8abd5d83 Backport 'Merge pull request #1098 from encoder32/DDC-1590' to 2.4 branch 2014-12-26 15:56:01 +02:00
Marco Pivetta 71f446f23b Bump version to 2.4.8 2014-12-16 14:47:17 +01:00
29 changed files with 692 additions and 66 deletions
+7 -6
View File
@@ -12,14 +12,15 @@ env:
- DB=sqlite
before_script:
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS doctrine_tests;' -U postgres; fi"
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS doctrine_tests_tmp;' -U postgres; fi"
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'create database doctrine_tests;' -U postgres; fi"
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'create database doctrine_tests_tmp;' -U postgres; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS doctrine_tests_tmp;create database IF NOT EXISTS doctrine_tests;'; fi"
- if [[ $TRAVIS_PHP_VERSION = '5.6' && $DB = 'sqlite' ]]; then PHPUNIT_FLAGS="--coverage-clover ./build/logs/clover.xml"; else PHPUNIT_FLAGS=""; fi
- if [ $DB = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS doctrine_tests;' -U postgres; fi
- if [ $DB = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS doctrine_tests_tmp;' -U postgres; fi
- if [ $DB = 'pgsql' ]; then psql -c 'create database doctrine_tests;' -U postgres; fi
- if [ $DB = 'pgsql' ]; then psql -c 'create database doctrine_tests_tmp;' -U postgres; fi
- if [ $DB = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS doctrine_tests_tmp;create database IF NOT EXISTS doctrine_tests;'; fi
- composer install --prefer-dist --dev
script: phpunit --configuration tests/travis/$DB.travis.xml
script: phpunit $PHPUNIT_FLAGS --configuration tests/travis/$DB.travis.xml
after_script:
- php vendor/bin/coveralls -v
@@ -78,7 +78,6 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
protected function initialize()
{
$this->driver = $this->em->getConfiguration()->getMetadataDriverImpl();
$this->targetPlatform = $this->em->getConnection()->getDatabasePlatform();
$this->evm = $this->em->getEventManager();
$this->initialized = true;
}
@@ -432,9 +431,9 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
{
$idGenType = $class->generatorType;
if ($idGenType == ClassMetadata::GENERATOR_TYPE_AUTO) {
if ($this->targetPlatform->prefersSequences()) {
if ($this->getTargetPlatform()->prefersSequences()) {
$class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_SEQUENCE);
} else if ($this->targetPlatform->prefersIdentityColumns()) {
} else if ($this->getTargetPlatform()->prefersIdentityColumns()) {
$class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_IDENTITY);
} else {
$class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_TABLE);
@@ -450,19 +449,23 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
$sequenceName = null;
$fieldName = $class->identifier ? $class->getSingleIdentifierFieldName() : null;
if ($this->targetPlatform instanceof Platforms\PostgreSQLPlatform) {
if ($this->getTargetPlatform() instanceof Platforms\PostgreSQLPlatform) {
$columnName = $class->getSingleIdentifierColumnName();
$quoted = isset($class->fieldMappings[$fieldName]['quoted']) || isset($class->table['quoted']);
$sequenceName = $class->getTableName() . '_' . $columnName . '_seq';
$definition = array(
'sequenceName' => $this->targetPlatform->fixSchemaElementName($sequenceName)
'sequenceName' => $this->getTargetPlatform()->fixSchemaElementName($sequenceName)
);
if ($quoted) {
$definition['quoted'] = true;
}
$sequenceName = $this->em->getConfiguration()->getQuoteStrategy()->getSequenceName($definition, $class, $this->targetPlatform);
$sequenceName = $this
->em
->getConfiguration()
->getQuoteStrategy()
->getSequenceName($definition, $class, $this->getTargetPlatform());
}
$generator = ($fieldName && $class->fieldMappings[$fieldName]['type'] === 'bigint')
@@ -483,7 +486,7 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
$quoted = isset($class->fieldMappings[$fieldName]['quoted']) || isset($class->table['quoted']);
$sequenceName = $class->getTableName() . '_' . $columnName . '_seq';
$definition = array(
'sequenceName' => $this->targetPlatform->fixSchemaElementName($sequenceName),
'sequenceName' => $this->getTargetPlatform()->fixSchemaElementName($sequenceName),
'allocationSize' => 1,
'initialValue' => 1,
);
@@ -496,7 +499,7 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
}
$sequenceGenerator = new \Doctrine\ORM\Id\SequenceGenerator(
$this->em->getConfiguration()->getQuoteStrategy()->getSequenceName($definition, $class, $this->targetPlatform),
$this->em->getConfiguration()->getQuoteStrategy()->getSequenceName($definition, $class, $this->getTargetPlatform()),
$definition['allocationSize']
);
$class->setIdGenerator($sequenceGenerator);
@@ -569,4 +572,16 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
{
return isset($class->isMappedSuperclass) && $class->isMappedSuperclass === false;
}
/**
* @return Platforms\AbstractPlatform
*/
private function getTargetPlatform()
{
if (!$this->targetPlatform) {
$this->targetPlatform = $this->em->getConnection()->getDatabasePlatform();
}
return $this->targetPlatform;
}
}
@@ -222,6 +222,13 @@ class OneToManyPersister extends AbstractCollectionPersister
*/
public function removeElement(PersistentCollection $coll, $element)
{
$mapping = $coll->getMapping();
if ( ! $mapping['orphanRemoval']) {
// no-op: this is not the owning side, therefore no operations should be applied
return false;
}
$uow = $this->em->getUnitOfWork();
// shortcut for new entities
@@ -237,11 +244,11 @@ class OneToManyPersister extends AbstractCollectionPersister
return false;
}
$mapping = $coll->getMapping();
$class = $this->em->getClassMetadata($mapping['targetEntity']);
$sql = 'DELETE FROM ' . $this->quoteStrategy->getTableName($class, $this->platform)
. ' WHERE ' . implode('= ? AND ', $class->getIdentifierColumnNames()) . ' = ?';
$this
->uow
->getEntityPersister($mapping['targetEntity'])
->delete($element);
return (bool) $this->conn->executeUpdate($sql, $this->getDeleteRowSQLParameters($coll, $element));
return true;
}
}
+24 -9
View File
@@ -892,6 +892,8 @@ class SqlWalker implements TreeWalker
}
}
$targetTableJoin = null;
// This condition is not checking ClassMetadata::MANY_TO_ONE, because by definition it cannot
// be the owning side and previously we ensured that $assoc is always the owning side of the associations.
// The owning side is necessary at this point because only it contains the JoinColumn information.
@@ -926,7 +928,10 @@ class SqlWalker implements TreeWalker
$conditions[] = $filterExpr;
}
$sql .= $targetTableName . ' ' . $targetTableAlias . ' ON ' . implode(' AND ', $conditions);
$targetTableJoin = array(
'table' => $targetTableName . ' ' . $targetTableAlias,
'condition' => implode(' AND ', $conditions),
);
break;
case ($assoc['type'] == ClassMetadata::MANY_TO_MANY):
@@ -978,20 +983,30 @@ class SqlWalker implements TreeWalker
$conditions[] = $filterExpr;
}
$sql .= $targetTableName . ' ' . $targetTableAlias . ' ON ' . implode(' AND ', $conditions);
$targetTableJoin = array(
'table' => $targetTableName . ' ' . $targetTableAlias,
'condition' => implode(' AND ', $conditions),
);
break;
}
// Handle WITH clause
if ($condExpr !== null) {
// Phase 2 AST optimization: Skip processing of ConditionalExpression
// if only one ConditionalTerm is defined
$sql .= ' AND (' . $this->walkConditionalExpression($condExpr) . ')';
$withCondition = (null === $condExpr) ? '' : ('(' . $this->walkConditionalExpression($condExpr) . ')');
if ($targetClass->isInheritanceTypeJoined()) {
$ctiJoins = $this->_generateClassTableInheritanceJoins($targetClass, $joinedDqlAlias);
// If we have WITH condition, we need to build nested joins for target class table and cti joins
if ($withCondition) {
$sql .= '(' . $targetTableJoin['table'] . $ctiJoins . ') ON ' . $targetTableJoin['condition'];
} else {
$sql .= $targetTableJoin['table'] . ' ON ' . $targetTableJoin['condition'] . $ctiJoins;
}
} else {
$sql .= $targetTableJoin['table'] . ' ON ' . $targetTableJoin['condition'];
}
// FIXME: these should either be nested or all forced to be left joins (DDC-XXX)
if ($targetClass->isInheritanceTypeJoined()) {
$sql .= $this->_generateClassTableInheritanceJoins($targetClass, $joinedDqlAlias);
if ($withCondition) {
$sql .= ' AND ' . $withCondition;
}
// Apply the indexes
@@ -137,7 +137,7 @@ EOT
// Process destination directory
if ( ! is_dir($destPath = $input->getArgument('dest-path'))) {
mkdir($destPath, 0777, true);
mkdir($destPath, 0775, true);
}
$destPath = realpath($destPath);
@@ -79,7 +79,7 @@ EOT
}
if ( ! is_dir($destPath)) {
mkdir($destPath, 0777, true);
mkdir($destPath, 0775, true);
}
$destPath = realpath($destPath);
+8 -7
View File
@@ -340,7 +340,7 @@ public function __construct()
$dir = dirname($path);
if ( ! is_dir($dir)) {
mkdir($dir, 0777, true);
mkdir($dir, 0775, true);
}
$this->isNew = !file_exists($path) || (file_exists($path) && $this->regenerateEntityIfExists);
@@ -365,6 +365,7 @@ public function __construct()
} elseif ( ! $this->isNew && $this->updateEntityIfExists) {
file_put_contents($path, $this->generateUpdatedEntityClass($metadata, $path));
}
chmod($path, 0664);
}
/**
@@ -679,7 +680,7 @@ public function __construct()
if ($token[0] == T_NAMESPACE) {
$lastSeenNamespace = "";
$inNamespace = true;
} elseif ($token[0] == T_CLASS) {
} elseif ($token[0] == T_CLASS && $tokens[$i-1][0] != T_DOUBLE_COLON) {
$inClass = true;
} elseif ($token[0] == T_FUNCTION) {
if ($tokens[$i+2][0] == T_STRING) {
@@ -701,9 +702,9 @@ public function __construct()
*/
protected function hasProperty($property, ClassMetadataInfo $metadata)
{
if ($this->extendsClass()) {
if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) {
// don't generate property if its already on the base class.
$reflClass = new \ReflectionClass($this->getClassToExtend());
$reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name);
if ($reflClass->hasProperty($property)) {
return true;
}
@@ -723,9 +724,9 @@ public function __construct()
*/
protected function hasMethod($method, ClassMetadataInfo $metadata)
{
if ($this->extendsClass()) {
if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) {
// don't generate method if its already on the base class.
$reflClass = new \ReflectionClass($this->getClassToExtend());
$reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name);
if ($reflClass->hasMethod($method)) {
return true;
@@ -1074,7 +1075,7 @@ public function __construct()
$lines[] = $this->generateFieldMappingPropertyDocBlock($fieldMapping, $metadata);
$lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldMapping['fieldName']
. (isset($fieldMapping['default']) ? ' = ' . var_export($fieldMapping['default'], true) : null) . ";\n";
. (isset($fieldMapping['options']['default']) ? ' = ' . var_export($fieldMapping['options']['default'], true) : null) . ";\n";
}
return implode("\n", $lines);
@@ -96,11 +96,12 @@ class <className> extends EntityRepository
$dir = dirname($path);
if ( ! is_dir($dir)) {
mkdir($dir, 0777, true);
mkdir($dir, 0775, true);
}
if ( ! file_exists($path)) {
file_put_contents($path, $code);
chmod($path, 0664);
}
}
}
@@ -130,7 +130,7 @@ abstract class AbstractExporter
public function export()
{
if ( ! is_dir($this->_outputDir)) {
mkdir($this->_outputDir, 0777, true);
mkdir($this->_outputDir, 0775, true);
}
foreach ($this->_metadata as $metadata) {
@@ -139,12 +139,13 @@ abstract class AbstractExporter
$path = $this->_generateOutputPath($metadata);
$dir = dirname($path);
if ( ! is_dir($dir)) {
mkdir($dir, 0777, true);
mkdir($dir, 0775, true);
}
if (file_exists($path) && !$this->_overwriteExistingFiles) {
throw ExportException::attemptOverwriteExistingFile($path);
}
file_put_contents($path, $output);
chmod($path, 0664);
}
}
}
+5
View File
@@ -1630,6 +1630,7 @@ class UnitOfWork implements PropertyChangedListener
case self::STATE_REMOVED:
// Entity becomes managed again
unset($this->entityDeletions[$oid]);
$this->addToIdentityMap($entity);
$this->entityStates[$oid] = self::STATE_MANAGED;
break;
@@ -2314,6 +2315,10 @@ class UnitOfWork implements PropertyChangedListener
return;
}
if ($entity instanceof Proxy && !$entity->__isInitialized__) {
$entity->__load();
}
$entityVersion = $class->reflFields[$class->versionField]->getValue($entity);
if ($entityVersion != $lockVersion) {
+1 -1
View File
@@ -36,7 +36,7 @@ class Version
/**
* Current Doctrine Version
*/
const VERSION = '2.4.7';
const VERSION = '2.4.8';
/**
* Compares a Doctrine version with the current one.
@@ -0,0 +1,56 @@
<?php
namespace Doctrine\Tests\Models\DDC1590;
/**
* @Entity
* @MappedSuperClass
*/
abstract class DDC1590Entity
{
/**
* @Id
* @Column(type="integer")
* @GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @Column(type="datetime")
*/
protected $created_at;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
*
* @return DDC1590User
*/
public function setCreatedAt($createdAt)
{
$this->created_at = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->created_at;
}
}
@@ -0,0 +1,18 @@
<?php
namespace Doctrine\Tests\Models\DDC1590;
use Doctrine\Tests\Models\DDC1590\DDC1590Entity;
/**
* @Entity
* @Table(name="users")
*/
class DDC1590User extends DDC1590Entity
{
/**
* @Column(type="string", length=255)
*/
protected $name;
}
@@ -0,0 +1,37 @@
<?php
namespace Doctrine\Tests\Models\Tweet;
/**
* @Entity
* @Table(name="tweet_tweet")
*/
class Tweet
{
const CLASSNAME = __CLASS__;
/**
* @Id
* @GeneratedValue
* @Column(type="integer")
*/
public $id;
/**
* @Column(type="string", length=140)
*/
public $content = '';
/**
* @ManyToOne(targetEntity="User", inversedBy="tweets", cascade={"persist"}, fetch="EXTRA_LAZY")
*/
public $author;
/**
* @param User $author
*/
public function setAuthor(User $author)
{
$this->author = $author;
}
}
@@ -0,0 +1,54 @@
<?php
namespace Doctrine\Tests\Models\Tweet;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @Entity
* @Table(name="tweet_user")
*/
class User
{
const CLASSNAME = __CLASS__;
/**
* @Id
* @GeneratedValue
* @Column(type="integer")
*/
public $id;
/**
* @Column(type="string")
*/
public $name;
/**
* @OneToMany(targetEntity="Tweet", mappedBy="author", cascade={"persist"}, fetch="EXTRA_LAZY")
*/
public $tweets;
/**
* @OneToMany(targetEntity="UserList", mappedBy="owner", fetch="EXTRA_LAZY", orphanRemoval=true)
*/
public $userLists;
public function __construct()
{
$this->tweets = new ArrayCollection();
$this->userLists = new ArrayCollection();
}
public function addTweet(Tweet $tweet)
{
$tweet->setAuthor($this);
$this->tweets->add($tweet);
}
public function addUserList(UserList $userList)
{
$userList->owner = $this;
$this->userLists->add($userList);
}
}
@@ -0,0 +1,29 @@
<?php
namespace Doctrine\Tests\Models\Tweet;
/**
* @Entity
* @Table(name="tweet_user_list")
*/
class UserList
{
const CLASSNAME = __CLASS__;
/**
* @Id
* @GeneratedValue
* @Column(type="integer")
*/
public $id;
/**
* @Column(type="string")
*/
public $listName;
/**
* @ManyToOne(targetEntity="User", inversedBy="userLists")
*/
public $owner;
}
@@ -3,6 +3,9 @@
namespace Doctrine\Tests\ORM\Functional;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\Tests\Models\Tweet\Tweet;
use Doctrine\Tests\Models\Tweet\User;
use Doctrine\Tests\Models\Tweet\UserList;
require_once __DIR__ . '/../../TestInit.php';
@@ -22,7 +25,10 @@ class ExtraLazyCollectionTest extends \Doctrine\Tests\OrmFunctionalTestCase
public function setUp()
{
$this->useModelSet('tweet');
$this->useModelSet('cms');
$this->useModelSet('tweet');
parent::setUp();
$class = $this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
@@ -363,7 +369,7 @@ class ExtraLazyCollectionTest extends \Doctrine\Tests\OrmFunctionalTestCase
$user->articles->removeElement($article);
$this->assertFalse($user->articles->isInitialized(), "Post-Condition: Collection is not initialized.");
$this->assertEquals($queryCount + 1, $this->getCurrentQueryCount());
$this->assertEquals($queryCount, $this->getCurrentQueryCount());
// Test One to Many removal with Entity state as new
$article = new \Doctrine\Tests\Models\CMS\CmsArticle();
@@ -384,7 +390,7 @@ class ExtraLazyCollectionTest extends \Doctrine\Tests\OrmFunctionalTestCase
$user->articles->removeElement($article);
$this->assertEquals($queryCount + 1, $this->getCurrentQueryCount(), "Removing a persisted entity should cause one query to be executed.");
$this->assertEquals($queryCount, $this->getCurrentQueryCount(), "Removing a persisted entity should cause one query to be executed.");
$this->assertFalse($user->articles->isInitialized(), "Post-Condition: Collection is not initialized.");
// Test One to Many removal with Entity state as managed
@@ -650,4 +656,204 @@ class ExtraLazyCollectionTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this->topic = $article1->topic;
$this->phonenumber = $phonenumber1->phonenumber;
}
/**
* @group DDC-3343
*/
public function testRemoveManagedElementFromOneToManyExtraLazyCollectionIsNoOp()
{
list($userId, $tweetId) = $this->loadTweetFixture();
/* @var $user User */
$user = $this->_em->find(User::CLASSNAME, $userId);
$user->tweets->removeElement($this->_em->find(Tweet::CLASSNAME, $tweetId));
$this->_em->clear();
/* @var $user User */
$user = $this->_em->find(User::CLASSNAME, $userId);
$this->assertCount(1, $user->tweets, 'Element was not removed - need to update the owning side first');
}
/**
* @group DDC-3343
*/
public function testRemoveManagedElementFromOneToManyExtraLazyCollectionWithoutDeletingTheTargetEntityEntryIsNoOp()
{
list($userId, $tweetId) = $this->loadTweetFixture();
/* @var $user User */
$user = $this->_em->find(User::CLASSNAME, $userId);
$tweet = $this->_em->find(Tweet::CLASSNAME, $tweetId);
$user->tweets->removeElement($tweet);
$this->_em->clear();
/* @var $tweet Tweet */
$tweet = $this->_em->find(Tweet::CLASSNAME, $tweetId);
$this->assertInstanceOf(
Tweet::CLASSNAME,
$tweet,
'Even though the collection is extra lazy, the tweet should not have been deleted'
);
$this->assertInstanceOf(
User::CLASSNAME,
$tweet->author,
'Tweet author link has not been removed - need to update the owning side first'
);
}
/**
* @group DDC-3343
*/
public function testRemovingManagedLazyProxyFromExtraLazyOneToManyDoesRemoveTheAssociationButNotTheEntity()
{
list($userId, $tweetId) = $this->loadTweetFixture();
/* @var $user User */
$user = $this->_em->find(User::CLASSNAME, $userId);
$tweet = $this->_em->getReference(Tweet::CLASSNAME, $tweetId);
$user->tweets->removeElement($this->_em->getReference(Tweet::CLASSNAME, $tweetId));
$this->_em->clear();
/* @var $tweet Tweet */
$tweet = $this->_em->find(Tweet::CLASSNAME, $tweet->id);
$this->assertInstanceOf(
Tweet::CLASSNAME,
$tweet,
'Even though the collection is extra lazy, the tweet should not have been deleted'
);
$this->assertInstanceOf(User::CLASSNAME, $tweet->author);
/* @var $user User */
$user = $this->_em->find(User::CLASSNAME, $userId);
$this->assertCount(1, $user->tweets, 'Element was not removed - need to update the owning side first');
}
/**
* @group DDC-3343
*/
public function testRemoveOrphanedManagedElementFromOneToManyExtraLazyCollection()
{
list($userId, $userListId) = $this->loadUserListFixture();
/* @var $user User */
$user = $this->_em->find(User::CLASSNAME, $userId);
$user->userLists->removeElement($this->_em->find(UserList::CLASSNAME, $userListId));
$this->_em->clear();
/* @var $user User */
$user = $this->_em->find(User::CLASSNAME, $userId);
$this->assertCount(0, $user->userLists, 'Element was removed from association due to orphan removal');
$this->assertNull(
$this->_em->find(UserList::CLASSNAME, $userListId),
'Element was deleted due to orphan removal'
);
}
/**
* @group DDC-3343
*/
public function testRemoveOrphanedUnManagedElementFromOneToManyExtraLazyCollection()
{
list($userId, $userListId) = $this->loadUserListFixture();
/* @var $user User */
$user = $this->_em->find(User::CLASSNAME, $userId);
$user->userLists->removeElement(new UserList());
$this->_em->clear();
/* @var $userList UserList */
$userList = $this->_em->find(UserList::CLASSNAME, $userListId);
$this->assertInstanceOf(
UserList::CLASSNAME,
$userList,
'Even though the collection is extra lazy + orphan removal, the user list should not have been deleted'
);
$this->assertInstanceOf(
User::CLASSNAME,
$userList->owner,
'User list to owner link has not been removed'
);
}
/**
* @group DDC-3343
*/
public function testRemoveOrphanedManagedLazyProxyFromExtraLazyOneToMany()
{
list($userId, $userListId) = $this->loadUserListFixture();
/* @var $user User */
$user = $this->_em->find(User::CLASSNAME, $userId);
$user->userLists->removeElement($this->_em->getReference(UserList::CLASSNAME, $userListId));
$this->_em->clear();
/* @var $user User */
$user = $this->_em->find(User::CLASSNAME, $userId);
$this->assertCount(0, $user->userLists, 'Element was removed from association due to orphan removal');
$this->assertNull(
$this->_em->find(UserList::CLASSNAME, $userListId),
'Element was deleted due to orphan removal'
);
}
/**
* @return int[] ordered tuple: user id and tweet id
*/
private function loadTweetFixture()
{
$user = new User();
$tweet = new Tweet();
$user->name = 'ocramius';
$tweet->content = 'The cat is on the table';
$user->addTweet($tweet);
$this->_em->persist($user);
$this->_em->persist($tweet);
$this->_em->flush();
$this->_em->clear();
return array($user->id, $tweet->id);
}
/**
* @return int[] ordered tuple: user id and user list id
*/
private function loadUserListFixture()
{
$user = new User();
$userList = new UserList();
$user->name = 'ocramius';
$userList->listName = 'PHP Developers to follow closely';
$user->addUserList($userList);
$this->_em->persist($user);
$this->_em->persist($userList);
$this->_em->flush();
$this->_em->clear();
return array($user->id, $userList->id);
}
}
@@ -152,6 +152,19 @@ class OptimisticTest extends \Doctrine\Tests\OrmFunctionalTestCase
}
}
public function testLockWorksWithProxy()
{
$test = new OptimisticStandard();
$test->name = 'test';
$this->_em->persist($test);
$this->_em->flush();
$this->_em->clear();
$proxy = $this->_em->getReference('Doctrine\Tests\ORM\Functional\Locking\OptimisticStandard', $test->id);
$this->_em->lock($proxy, LockMode::OPTIMISTIC, 1);
}
public function testOptimisticTimestampSetsDefaultValue()
{
$test = new OptimisticTimestamp();
@@ -9,8 +9,10 @@ require_once __DIR__ . '/../../../TestInit.php';
class PostgreSqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase
{
protected function setUp() {
protected function setUp()
{
parent::setUp();
if ($this->_em->getConnection()->getDatabasePlatform()->getName() !== 'postgresql') {
$this->markTestSkipped('The ' . __CLASS__ .' requires the use of postgresql.');
}
@@ -19,6 +21,7 @@ class PostgreSqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase
public function testPostgresMetadataSequenceIncrementedBy10()
{
$address = $this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress');
$this->assertEquals(1, $address->sequenceGeneratorDefinition['allocationSize']);
}
@@ -97,7 +100,9 @@ class PostgreSqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase
$sql = $tool->getDropSchemaSQL($classes);
$this->assertEquals(14, count($sql));
$dropSequenceSQLs = 0;
foreach ($sql AS $stmt) {
if (strpos($stmt, "DROP SEQUENCE") === 0) {
$dropSequenceSQLs++;
@@ -115,10 +120,6 @@ class PostgreSqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1657Screen'),
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1657Avatar'),
);
try {
$this->_em->getConnection()->exec("CREATE SCHEMA stonewood");
} catch(\Exception $e) {
}
$tool = new SchemaTool($this->_em);
$tool->createSchema($classes);
@@ -20,6 +20,7 @@ class DDC1360Test extends OrmFunctionalTestCase
));
$this->assertEquals(array(
'CREATE SCHEMA user',
'CREATE TABLE "user"."user" (id INT NOT NULL, PRIMARY KEY(id))',
'CREATE SEQUENCE "user"."user_id_seq" INCREMENT BY 1 MINVALUE 1 START 1',
), $sql);
@@ -192,15 +192,38 @@ class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase
$rootMetadata = $cmf->getMetadataFor('Doctrine\Tests\Models\JoinedInheritanceType\RootClass');
}
protected function _createEntityManager($metadataDriver)
public function testGetAllMetadataWorksWithBadConnection()
{
// DDC-3551
$conn = $this->getMockBuilder('Doctrine\DBAL\Connection')
->disableOriginalConstructor()
->getMock();
$mockDriver = new MetadataDriverMock();
$em = $this->_createEntityManager($mockDriver, $conn);
$conn->expects($this->any())
->method('getDatabasePlatform')
->will($this->throwException(new \Exception('Exception thrown in test when calling getDatabasePlatform')));
$cmf = new ClassMetadataFactory();
$cmf->setEntityManager($em);
// getting all the metadata should work, even if get DatabasePlatform blows up
$metadata = $cmf->getAllMetadata();
// this will just be an empty array - there was no error
$this->assertEquals(array(), $metadata);
}
protected function _createEntityManager($metadataDriver, $conn = null)
{
$driverMock = new DriverMock();
$config = new \Doctrine\ORM\Configuration();
$config->setProxyDir(__DIR__ . '/../../Proxies');
$config->setProxyNamespace('Doctrine\Tests\Proxies');
$eventManager = new EventManager();
$conn = new ConnectionMock(array(), $driverMock, $config, $eventManager);
$mockDriver = new MetadataDriverMock();
if (!$conn) {
$conn = new ConnectionMock(array(), $driverMock, $config, $eventManager);
}
$config->setMetadataDriverImpl($metadataDriver);
return EntityManagerMock::create($conn, $config, $eventManager);
@@ -2058,7 +2058,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
{
$this->assertSqlGeneration(
'SELECT e.id FROM Doctrine\Tests\Models\Company\CompanyOrganization o JOIN o.events e WITH e.id = ?1',
'SELECT c0_.id AS id0 FROM company_organizations c1_ INNER JOIN company_events c0_ ON c1_.id = c0_.org_id AND (c0_.id = ?) LEFT JOIN company_auctions c2_ ON c0_.id = c2_.id LEFT JOIN company_raffles c3_ ON c0_.id = c3_.id',
'SELECT c0_.id AS id0 FROM company_organizations c1_ INNER JOIN (company_events c0_ LEFT JOIN company_auctions c2_ ON c0_.id = c2_.id LEFT JOIN company_raffles c3_ ON c0_.id = c3_.id) ON c1_.id = c0_.org_id AND (c0_.id = ?)',
array(Query::HINT_FORCE_PARTIAL_LOAD => false)
);
}
@@ -2,6 +2,7 @@
namespace Doctrine\Tests\ORM\Tools;
use Doctrine\ORM\Mapping\ClassMetadataFactory;
use Doctrine\ORM\Tools\SchemaTool,
Doctrine\ORM\Tools\EntityGenerator,
Doctrine\ORM\Tools\Export\ClassMetadataExporter,
@@ -55,7 +56,7 @@ class EntityGeneratorTest extends \Doctrine\Tests\OrmTestCase
$metadata->table['uniqueConstraints']['name_uniq'] = array('columns' => array('name'));
$metadata->table['indexes']['status_idx'] = array('columns' => array('status'));
$metadata->mapField(array('fieldName' => 'name', 'type' => 'string'));
$metadata->mapField(array('fieldName' => 'status', 'type' => 'string', 'default' => 'published'));
$metadata->mapField(array('fieldName' => 'status', 'type' => 'string', 'options' => array('default' => 'published')));
$metadata->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
$metadata->mapOneToOne(array('fieldName' => 'author', 'targetEntity' => 'Doctrine\Tests\ORM\Tools\EntityGeneratorAuthor', 'mappedBy' => 'book'));
$joinColumns = array(
@@ -454,6 +455,97 @@ class EntityGeneratorTest extends \Doctrine\Tests\OrmTestCase
$this->assertEquals($value, $entity->{$getter}());
}
/**
* @group DDC-1590
*/
public function testMethodsAndPropertiesAreNotDuplicatedInChildClasses()
{
$cmf = new ClassMetadataFactory();
$em = $this->_getTestEntityManager();
$cmf->setEntityManager($em);
$ns = $this->_namespace;
$nsdir = $this->_tmpDir . '/' . $ns;
$content = str_replace(
'namespace Doctrine\Tests\Models\DDC1590',
'namespace ' . $ns,
file_get_contents(__DIR__ . '/../../Models/DDC1590/DDC1590User.php')
);
$fname = $nsdir . "/DDC1590User.php";
file_put_contents($fname, $content);
require $fname;
$metadata = $cmf->getMetadataFor($ns . '\DDC1590User');
$this->_generator->writeEntityClass($metadata, $this->_tmpDir);
// class DDC1590User extends DDC1590Entity { ... }
$source = file_get_contents($fname);
// class _DDC1590User extends DDC1590Entity { ... }
$source2 = str_replace('class DDC1590User', 'class _DDC1590User', $source);
$fname2 = $nsdir . "/_DDC1590User.php";
file_put_contents($fname2, $source2);
require $fname2;
// class __DDC1590User { ... }
$source3 = str_replace('class DDC1590User extends DDC1590Entity', 'class __DDC1590User', $source);
$fname3 = $nsdir . "/__DDC1590User.php";
file_put_contents($fname3, $source3);
require $fname3;
// class _DDC1590User extends DDC1590Entity { ... }
$rc2 = new \ReflectionClass($ns.'\_DDC1590User');
$this->assertTrue($rc2->hasProperty('name'));
$this->assertTrue($rc2->hasProperty('id'));
$this->assertTrue($rc2->hasProperty('created_at'));
$this->assertTrue($rc2->hasMethod('getName'));
$this->assertTrue($rc2->hasMethod('setName'));
$this->assertTrue($rc2->hasMethod('getId'));
$this->assertFalse($rc2->hasMethod('setId'));
$this->assertTrue($rc2->hasMethod('getCreatedAt'));
$this->assertTrue($rc2->hasMethod('setCreatedAt'));
// class __DDC1590User { ... }
$rc3 = new \ReflectionClass($ns.'\__DDC1590User');
$this->assertTrue($rc3->hasProperty('name'));
$this->assertFalse($rc3->hasProperty('id'));
$this->assertFalse($rc3->hasProperty('created_at'));
$this->assertTrue($rc3->hasMethod('getName'));
$this->assertTrue($rc3->hasMethod('setName'));
$this->assertFalse($rc3->hasMethod('getId'));
$this->assertFalse($rc3->hasMethod('setId'));
$this->assertFalse($rc3->hasMethod('getCreatedAt'));
$this->assertFalse($rc3->hasMethod('setCreatedAt'));
}
public function testRegenerateEntityClass()
{
$metadata = $this->generateBookEntityFixture();
$this->loadEntityClass($metadata);
$className = basename(str_replace('\\', '/', $metadata->name));
$path = $this->_tmpDir . '/' . $this->_namespace . '/' . $className . '.php';
$classTest = file_get_contents($path);
$this->_generator->setRegenerateEntityIfExists(true);
$this->_generator->setBackupExisting(false);
$this->_generator->writeEntityClass($metadata, $this->_tmpDir);
$classNew = file_get_contents($path);
$this->assertSame($classTest,$classNew);
}
/**
* @return array
*/
@@ -552,9 +644,32 @@ class
',
array('Foo\Bar\Baz'),
),
array(
'
<?php namespace Foo\Bar; class Baz {
public static function someMethod(){
return self::class;
}
}
',
array('Foo\Bar\Baz'),
),
);
}
/**
* @param ClassMetadataInfo $metadata
*/
private function loadEntityClass(ClassMetadataInfo $metadata)
{
$className = basename(str_replace('\\', '/', $metadata->name));
$path = $this->_tmpDir . '/' . $this->_namespace . '/' . $className . '.php';
$this->assertFileExists($path);
require_once $path;
}
/**
* @param string $type
* @param \ReflectionProperty $property
@@ -229,6 +229,25 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase
$this->setExpectedException('InvalidArgumentException');
$this->_unitOfWork->lock(null, null, null);
}
/**
* @group DDC-3619
* @group 1338
*/
public function testRemovedAndRePersistedEntitiesAreInTheIdentityMapAndAreNotGarbageCollected()
{
$entity = new ForumUser();
$entity->id = 123;
$this->_unitOfWork->registerManaged($entity, array('id' => 123), array());
$this->assertTrue($this->_unitOfWork->isInIdentityMap($entity));
$this->_unitOfWork->remove($entity);
$this->assertFalse($this->_unitOfWork->isInIdentityMap($entity));
$this->_unitOfWork->persist($entity);
$this->assertTrue($this->_unitOfWork->isInIdentityMap($entity));
}
}
/**
@@ -139,6 +139,10 @@ abstract class OrmFunctionalTestCase extends OrmTestCase
'Doctrine\Tests\Models\StockExchange\Stock',
'Doctrine\Tests\Models\StockExchange\Market',
),
'tweet' => array(
'Doctrine\Tests\Models\Tweet\Tweet',
'Doctrine\Tests\Models\Tweet\User',
),
'legacy' => array(
'Doctrine\Tests\Models\Legacy\LegacyUser',
'Doctrine\Tests\Models\Legacy\LegacyUserReference',
@@ -162,6 +166,11 @@ abstract class OrmFunctionalTestCase extends OrmTestCase
'Doctrine\Tests\Models\Taxi\Car',
'Doctrine\Tests\Models\Taxi\Driver',
),
'tweet' => array(
'Doctrine\Tests\Models\Tweet\User',
'Doctrine\Tests\Models\Tweet\Tweet',
'Doctrine\Tests\Models\Tweet\UserList',
),
);
/**
@@ -269,6 +278,11 @@ abstract class OrmFunctionalTestCase extends OrmTestCase
$conn->executeUpdate('DELETE FROM exchange_stocks');
$conn->executeUpdate('DELETE FROM exchange_markets');
}
if (isset($this->_usedModelSets['tweet'])) {
$conn->executeUpdate('DELETE FROM tweet_tweet');
$conn->executeUpdate('DELETE FROM tweet_user_list');
$conn->executeUpdate('DELETE FROM tweet_user');
}
if (isset($this->_usedModelSets['legacy'])) {
$conn->executeUpdate('DELETE FROM legacy_users_cars');
$conn->executeUpdate('DELETE FROM legacy_users_reference');
@@ -297,6 +311,12 @@ abstract class OrmFunctionalTestCase extends OrmTestCase
$conn->executeUpdate('DELETE FROM taxi_driver');
}
if (isset($this->_usedModelSets['tweet'])) {
$conn->executeUpdate('DELETE FROM tweet_tweet');
$conn->executeUpdate('DELETE FROM tweet_user_list');
$conn->executeUpdate('DELETE FROM tweet_user');
}
$this->_em->clear();
}
-4
View File
@@ -16,10 +16,6 @@
<var name="tmpdb_port" value="3306"/>
</php>
<logging>
<log type="coverage-clover" target="../../build/logs/clover.xml"/>
</logging>
<testsuites>
<testsuite name="Doctrine ORM Test Suite">
<directory>./../Doctrine/Tests/ORM</directory>
-4
View File
@@ -19,10 +19,6 @@
<var name="tmpdb_port" value="5432"/>
</php>
<logging>
<log type="coverage-clover" target="../../build/logs/clover.xml"/>
</logging>
<testsuites>
<testsuite name="Doctrine ORM Test Suite">
<directory>./../Doctrine/Tests/ORM</directory>
-4
View File
@@ -1,10 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit>
<logging>
<log type="coverage-clover" target="../../build/logs/clover.xml"/>
</logging>
<testsuites>
<testsuite name="Doctrine ORM Test Suite">
<directory>./../Doctrine/Tests/ORM</directory>