Merge branch 'DBAL-204'
This commit is contained in:
commit
1d6a21f7fa
@ -21,6 +21,8 @@ namespace Doctrine\ORM\Tools;
|
|||||||
|
|
||||||
use Doctrine\ORM\ORMException,
|
use Doctrine\ORM\ORMException,
|
||||||
Doctrine\DBAL\Types\Type,
|
Doctrine\DBAL\Types\Type,
|
||||||
|
Doctrine\DBAL\Schema\Schema,
|
||||||
|
Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets,
|
||||||
Doctrine\ORM\EntityManager,
|
Doctrine\ORM\EntityManager,
|
||||||
Doctrine\ORM\Mapping\ClassMetadata,
|
Doctrine\ORM\Mapping\ClassMetadata,
|
||||||
Doctrine\ORM\Internal\CommitOrderCalculator,
|
Doctrine\ORM\Internal\CommitOrderCalculator,
|
||||||
@ -127,7 +129,7 @@ class SchemaTool
|
|||||||
$sm = $this->_em->getConnection()->getSchemaManager();
|
$sm = $this->_em->getConnection()->getSchemaManager();
|
||||||
$metadataSchemaConfig = $sm->createSchemaConfig();
|
$metadataSchemaConfig = $sm->createSchemaConfig();
|
||||||
$metadataSchemaConfig->setExplicitForeignKeyIndexes(false);
|
$metadataSchemaConfig->setExplicitForeignKeyIndexes(false);
|
||||||
$schema = new \Doctrine\DBAL\Schema\Schema(array(), array(), $metadataSchemaConfig);
|
$schema = new Schema(array(), array(), $metadataSchemaConfig);
|
||||||
|
|
||||||
$evm = $this->_em->getEventManager();
|
$evm = $this->_em->getEventManager();
|
||||||
|
|
||||||
@ -252,6 +254,10 @@ class SchemaTool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! $this->_platform->supportsSchemas() && ! $this->_platform->canEmulateSchemas() ) {
|
||||||
|
$schema->visit(new RemoveNamespacedAssets());
|
||||||
|
}
|
||||||
|
|
||||||
if ($evm->hasListeners(ToolEvents::postGenerateSchema)) {
|
if ($evm->hasListeners(ToolEvents::postGenerateSchema)) {
|
||||||
$evm->dispatchEvent(ToolEvents::postGenerateSchema, new GenerateSchemaEventArgs($this->_em, $schema));
|
$evm->dispatchEvent(ToolEvents::postGenerateSchema, new GenerateSchemaEventArgs($this->_em, $schema));
|
||||||
}
|
}
|
||||||
|
2
lib/vendor/doctrine-dbal
vendored
2
lib/vendor/doctrine-dbal
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 29b714b7fe72641d749ae90324a5759853fe09b0
|
Subproject commit 480b127fb5c35d6fbd70964a228cd63cfe2b7e14
|
@ -64,4 +64,31 @@ class MySqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
$this->assertEquals(1, count($sql));
|
$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]);
|
$this->assertEquals("CREATE TABLE boolean_model (id INT AUTO_INCREMENT NOT NULL, booleanField TINYINT(1) NOT NULL, PRIMARY KEY(id)) ENGINE = InnoDB", $sql[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group DBAL-204
|
||||||
|
*/
|
||||||
|
public function testGetCreateSchemaSql4()
|
||||||
|
{
|
||||||
|
$classes = array(
|
||||||
|
$this->_em->getClassMetadata(__NAMESPACE__ . '\\MysqlSchemaNamespacedEntity')
|
||||||
|
);
|
||||||
|
|
||||||
|
$tool = new SchemaTool($this->_em);
|
||||||
|
$sql = $tool->getCreateSchemaSql($classes);
|
||||||
|
|
||||||
|
$this->assertEquals(0, count($sql));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Entity
|
||||||
|
* @Table("namespace.entity")
|
||||||
|
*/
|
||||||
|
class MysqlSchemaNamespacedEntity
|
||||||
|
{
|
||||||
|
/** @Column(type="integer") @Id @GeneratedValue */
|
||||||
|
public $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user