本文整理汇总了PHP中Doctrine\DBAL\Platforms\AbstractPlatform::getCreateSchemaSQL方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractPlatform::getCreateSchemaSQL方法的具体用法?PHP AbstractPlatform::getCreateSchemaSQL怎么用?PHP AbstractPlatform::getCreateSchemaSQL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Platforms\AbstractPlatform
的用法示例。
在下文中一共展示了AbstractPlatform::getCreateSchemaSQL方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getQueries
/**
* Gets all queries collected so far.
*
* @return array
*/
public function getQueries()
{
$sql = array();
foreach (array_keys($this->createTableQueries) as $namespace) {
if ($this->platform->supportsSchemas() && $this->platform->schemaNeedsCreation($namespace)) {
$query = $this->platform->getCreateSchemaSQL($namespace);
array_push($sql, $query);
}
}
foreach ($this->createTableQueries as $schemaSql) {
$sql = array_merge($sql, $schemaSql);
}
foreach ($this->createSequenceQueries as $schemaSql) {
$sql = array_merge($sql, $schemaSql);
}
foreach ($this->createFkConstraintQueries as $schemaSql) {
$sql = array_merge($sql, $schemaSql);
}
return $sql;
}
示例2: _toSql
/**
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
* @param boolean $saveMode
*
* @return array
*/
protected function _toSql(AbstractPlatform $platform, $saveMode = false)
{
$sql = array();
if ($platform->supportsSchemas()) {
foreach ($this->newNamespaces as $newNamespace) {
$sql[] = $platform->getCreateSchemaSQL($newNamespace);
}
}
if ($platform->supportsForeignKeyConstraints() && $saveMode == false) {
foreach ($this->orphanedForeignKeys as $orphanedForeignKey) {
$sql[] = $platform->getDropForeignKeySQL($orphanedForeignKey, $orphanedForeignKey->getLocalTableName());
}
}
if ($platform->supportsSequences() == true) {
foreach ($this->changedSequences as $sequence) {
$sql[] = $platform->getAlterSequenceSQL($sequence);
}
if ($saveMode === false) {
foreach ($this->removedSequences as $sequence) {
$sql[] = $platform->getDropSequenceSQL($sequence);
}
}
foreach ($this->newSequences as $sequence) {
$sql[] = $platform->getCreateSequenceSQL($sequence);
}
}
$foreignKeySql = array();
foreach ($this->newTables as $table) {
$sql = array_merge($sql, $platform->getCreateTableSQL($table, AbstractPlatform::CREATE_INDEXES));
if ($platform->supportsForeignKeyConstraints()) {
foreach ($table->getForeignKeys() as $foreignKey) {
$foreignKeySql[] = $platform->getCreateForeignKeySQL($foreignKey, $table);
}
}
}
$sql = array_merge($sql, $foreignKeySql);
if ($saveMode === false) {
foreach ($this->removedTables as $table) {
$sql[] = $platform->getDropTableSQL($table);
}
}
foreach ($this->changedTables as $tableDiff) {
$sql = array_merge($sql, $platform->getAlterTableSQL($tableDiff));
}
return $sql;
}
示例3: acceptNamespace
/**
* {@inheritdoc}
*/
public function acceptNamespace($namespaceName)
{
if ($this->platform->supportsSchemas()) {
$this->createNamespaceQueries[] = $this->platform->getCreateSchemaSQL($namespaceName);
}
}
示例4: acceptNamespace
/**
* {@inheritdoc}
*/
public function acceptNamespace($namespaceName)
{
if ($this->platform->supportsSchemas()) {
$this->createNamespaceQueries = array_merge($this->createNamespaceQueries, (array) $this->platform->getCreateSchemaSQL($namespaceName));
}
}
示例5: testGetCreateSchemaSQL
/**
* @expectedException \Doctrine\DBAL\DBALException
*/
public function testGetCreateSchemaSQL()
{
$this->_platform->getCreateSchemaSQL('schema');
}