SQLAzurePlatform.php 921 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
<?php

namespace Doctrine\DBAL\Platforms;

use Doctrine\DBAL\Schema\Table;

/**
 * Platform to ensure compatibility of Doctrine with SQL Azure
 *
 * On top of SQL Server 2008 the following functionality is added:
 *
 * - Create tables with the FEDERATED ON syntax.
 */
14
class SQLAzurePlatform extends SQLServerPlatform
15
{
16 17 18
    /**
     * {@inheritDoc}
     */
19
    public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDEXES)
20 21 22
    {
        $sql = parent::getCreateTableSQL($table, $createFlags);

23
        if ($table->hasOption('azure.federatedOnColumnName')) {
24
            $distributionName = $table->getOption('azure.federatedOnDistributionName');
25 26
            $columnName       = $table->getOption('azure.federatedOnColumnName');
            $stmt             = ' FEDERATED ON (' . $distributionName . ' = ' . $columnName . ')';
27

28
            $sql[0] .= $stmt;
29
        }
30

31 32 33
        return $sql;
    }
}