[DBAL-204] Filter namespaced assets if Schemas/Emulation is not supported.
This commit is contained in:
parent
febfe35c23
commit
0f3abde413
@ -21,6 +21,8 @@ namespace Doctrine\ORM\Tools;
|
||||
|
||||
use Doctrine\ORM\ORMException,
|
||||
Doctrine\DBAL\Types\Type,
|
||||
Doctrine\DBAL\Schema\Schema,
|
||||
Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets,
|
||||
Doctrine\ORM\EntityManager,
|
||||
Doctrine\ORM\Mapping\ClassMetadata,
|
||||
Doctrine\ORM\Internal\CommitOrderCalculator,
|
||||
@ -127,7 +129,7 @@ class SchemaTool
|
||||
$sm = $this->_em->getConnection()->getSchemaManager();
|
||||
$metadataSchemaConfig = $sm->createSchemaConfig();
|
||||
$metadataSchemaConfig->setExplicitForeignKeyIndexes(false);
|
||||
$schema = new \Doctrine\DBAL\Schema\Schema(array(), array(), $metadataSchemaConfig);
|
||||
$schema = new Schema(array(), array(), $metadataSchemaConfig);
|
||||
|
||||
$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)) {
|
||||
$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("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