Merge origin/master
This commit is contained in:
commit
5918058d86
@ -318,7 +318,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
public $discriminatorMap = array();
|
||||
|
||||
/**
|
||||
* READ-ONLY: The definition of the descriminator column used in JOINED and SINGLE_TABLE
|
||||
* READ-ONLY: The definition of the discriminator column used in JOINED and SINGLE_TABLE
|
||||
* inheritance mappings.
|
||||
*
|
||||
* @var array
|
||||
|
@ -288,7 +288,7 @@ class MappingException extends \Doctrine\ORM\ORMException
|
||||
public static function mappedClassNotPartOfDiscriminatorMap($className, $rootClassName)
|
||||
{
|
||||
return new self(
|
||||
"Entity '" . $className . "' has to be part of the descriminator map of '" . $rootClassName . "' " .
|
||||
"Entity '" . $className . "' has to be part of the discriminator map of '" . $rootClassName . "' " .
|
||||
"to be properly mapped in the inheritance hierachy. Alternatively you can make '".$className."' an abstract class " .
|
||||
"to avoid this exception from occuring."
|
||||
);
|
||||
|
@ -57,7 +57,7 @@ abstract class Base
|
||||
|
||||
public function add($arg)
|
||||
{
|
||||
if ( $arg !== null || ($arg instanceof self && $arg->count() > 0)) {
|
||||
if ( $arg !== null ) {
|
||||
// If we decide to keep Expr\Base instances, we can use this check
|
||||
if ( ! is_string($arg)) {
|
||||
$class = get_class($arg);
|
||||
|
@ -2054,6 +2054,11 @@ class UnitOfWork implements PropertyChangedListener
|
||||
// Loading the entity right here, if its in the eager loading map get rid of it there.
|
||||
unset($this->eagerLoadingEntities[$class->rootEntityName][$idHash]);
|
||||
|
||||
if (isset($this->eagerLoadingEntities[$class->rootEntityName]) &&
|
||||
! $this->eagerLoadingEntities[$class->rootEntityName]) {
|
||||
unset($this->eagerLoadingEntities[$class->rootEntityName]);
|
||||
}
|
||||
|
||||
// Properly initialize any unfetched associations, if partial objects are not allowed.
|
||||
if ( ! isset($hints[Query::HINT_FORCE_PARTIAL_LOAD])) {
|
||||
foreach ($class->associationMappings as $field => $assoc) {
|
||||
|
2
lib/vendor/doctrine-dbal
vendored
2
lib/vendor/doctrine-dbal
vendored
@ -1 +1 @@
|
||||
Subproject commit dea79e7bfbabf973e807539e258ccf3b9ee98f45
|
||||
Subproject commit 537de7ea6a34edbcc40bc6ca92e0a3f816b59330
|
@ -98,7 +98,7 @@ class DatabaseDriverTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$this->assertArrayHasKey('CmsUsers', $metadatas, 'CmsUsers entity was not detected.');
|
||||
$this->assertArrayHasKey('CmsGroups', $metadatas, 'CmsGroups entity was not detected.');
|
||||
|
||||
$this->assertEquals(1, count($metadatas['CmsUsers']->associationMappings));
|
||||
$this->assertEquals(2, count($metadatas['CmsUsers']->associationMappings));
|
||||
$this->assertArrayHasKey('group', $metadatas['CmsUsers']->associationMappings);
|
||||
$this->assertEquals(1, count($metadatas['CmsGroups']->associationMappings));
|
||||
$this->assertArrayHasKey('user', $metadatas['CmsGroups']->associationMappings);
|
||||
|
@ -19,8 +19,8 @@ class PostFlushEventTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->useModelSet('cms');
|
||||
parent::setUp();
|
||||
$this->listener = new PostFlushListener();
|
||||
$evm = $this->_em->getEventManager();
|
||||
$evm->addEventListener(Events::postFlush, $this->listener);
|
||||
|
@ -27,15 +27,16 @@ class MySqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$tool = new SchemaTool($this->_em);
|
||||
$sql = $tool->getCreateSchemaSql($classes);
|
||||
$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)) ENGINE = InnoDB", $sql[0]);
|
||||
$this->assertEquals("CREATE TABLE cms_users (id INT AUTO_INCREMENT NOT NULL, status VARCHAR(50) NOT NULL, username VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_3AF03EC5F85E0677 (username), PRIMARY KEY(id)) ENGINE = InnoDB", $sql[1]);
|
||||
$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)) 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)) ENGINE = InnoDB", $sql[2]);
|
||||
$this->assertEquals("CREATE TABLE cms_phonenumbers (phonenumber VARCHAR(50) NOT NULL, user_id INT DEFAULT NULL, INDEX IDX_F21F790FA76ED395 (user_id), PRIMARY KEY(phonenumber)) ENGINE = InnoDB", $sql[3]);
|
||||
$this->assertEquals("ALTER TABLE cms_addresses ADD FOREIGN KEY (user_id) REFERENCES cms_users(id)", $sql[4]);
|
||||
$this->assertEquals("ALTER TABLE cms_users_groups ADD FOREIGN KEY (user_id) REFERENCES cms_users(id)", $sql[5]);
|
||||
$this->assertEquals("ALTER TABLE cms_users_groups ADD FOREIGN KEY (group_id) REFERENCES cms_groups(id)", $sql[6]);
|
||||
$this->assertEquals("ALTER TABLE cms_phonenumbers ADD FOREIGN KEY (user_id) REFERENCES cms_users(id)", $sql[7]);
|
||||
|
||||
$this->assertEquals(8, count($sql));
|
||||
$this->assertEquals("ALTER TABLE cms_addresses ADD CONSTRAINT FK_ACAC157BA76ED395 FOREIGN KEY (user_id) REFERENCES cms_users (id)", $sql[4]);
|
||||
$this->assertEquals("ALTER TABLE cms_users ADD CONSTRAINT FK_3AF03EC5A832C1C9 FOREIGN KEY (email_id) REFERENCES cms_emails (id)", $sql[5]);
|
||||
$this->assertEquals("ALTER TABLE cms_users_groups ADD CONSTRAINT FK_7EA9409AA76ED395 FOREIGN KEY (user_id) REFERENCES cms_users (id)", $sql[6]);
|
||||
$this->assertEquals("ALTER TABLE cms_users_groups ADD CONSTRAINT FK_7EA9409AFE54D947 FOREIGN KEY (group_id) REFERENCES cms_groups (id)", $sql[7]);
|
||||
$this->assertEquals("ALTER TABLE cms_phonenumbers ADD CONSTRAINT FK_F21F790FA76ED395 FOREIGN KEY (user_id) REFERENCES cms_users (id)", $sql[8]);
|
||||
|
||||
$this->assertEquals(9, count($sql));
|
||||
}
|
||||
|
||||
public function testGetCreateSchemaSql2()
|
||||
@ -63,4 +64,4 @@ class MySqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$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)) ENGINE = InnoDB", $sql[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ class BasicInheritanceMappingTest extends \Doctrine\Tests\OrmTestCase
|
||||
*/
|
||||
public function testUnmappedEntityInHierachy()
|
||||
{
|
||||
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException', "Entity 'Doctrine\Tests\ORM\Mapping\HierachyBEntity' has to be part of the descriminator map of 'Doctrine\Tests\ORM\Mapping\HierachyBase' to be properly mapped in the inheritance hierachy. Alternatively you can make 'Doctrine\Tests\ORM\Mapping\HierachyBEntity' an abstract class to avoid this exception from occuring.");
|
||||
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException', "Entity 'Doctrine\Tests\ORM\Mapping\HierachyBEntity' has to be part of the discriminator map of 'Doctrine\Tests\ORM\Mapping\HierachyBase' to be properly mapped in the inheritance hierachy. Alternatively you can make 'Doctrine\Tests\ORM\Mapping\HierachyBEntity' an abstract class to avoid this exception from occuring.");
|
||||
|
||||
$class = $this->_factory->getMetadataFor(__NAMESPACE__ . '\\HierachyE');
|
||||
}
|
||||
|
@ -70,10 +70,16 @@ class TestUtil
|
||||
} else {
|
||||
$sm = $realConn->getSchemaManager();
|
||||
|
||||
$tableNames = $sm->listTableNames();
|
||||
|
||||
foreach ($tableNames AS $tableName) {
|
||||
$sm->dropTable($tableName);
|
||||
/* @var $schema Schema */
|
||||
$schema = $sm->createSchema();
|
||||
$stmts = $schema->toDropSql($realConn->getDatabasePlatform());
|
||||
|
||||
foreach ($stmts AS $stmt) {
|
||||
try {
|
||||
$realConn->exec($stmt);
|
||||
} catch(\Exception $e) {
|
||||
// TODO: Now is this a real good idea?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user