SQLAzurePlatform.php 943 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
<?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.
13 14
 *
 * @deprecated
15 16 17
 */
class SQLAzurePlatform extends SQLServer2008Platform
{
18 19 20
    /**
     * {@inheritDoc}
     */
21
    public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDEXES)
22 23 24
    {
        $sql = parent::getCreateTableSQL($table, $createFlags);

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

30
            $sql[0] .= $stmt;
31
        }
32

33 34 35
        return $sql;
    }
}