Commit 29b26232 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Fixed Coding Standard Violations and other cleanups

parent fbc1341d
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\DriverManager;
use Doctrine\Shards\DBAL\SQLAzure\SQLAzureShardManager; use Doctrine\Shards\DBAL\SQLAzure\SQLAzureShardManager;
require_once "vendor/composer/autoload.php"; require_once "vendor/autoload.php";
$config = array( $config = array(
'dbname' => 'SalesDB', 'dbname' => 'SalesDB',
......
...@@ -74,9 +74,9 @@ class SingleDatabaseSynchronizer implements SchemaSynchronizer ...@@ -74,9 +74,9 @@ class SingleDatabaseSynchronizer implements SchemaSynchronizer
if ($noDrops) { if ($noDrops) {
return $schemaDiff->toSaveSql($this->platform); return $schemaDiff->toSaveSql($this->platform);
} else {
return $schemaDiff->toSql($this->platform);
} }
return $schemaDiff->toSql($this->platform);
} }
/** /**
...@@ -146,7 +146,7 @@ class SingleDatabaseSynchronizer implements SchemaSynchronizer ...@@ -146,7 +146,7 @@ class SingleDatabaseSynchronizer implements SchemaSynchronizer
public function getDropAllSchema() public function getDropAllSchema()
{ {
$sm = $this->conn->getSchemaManager(); $sm = $this->conn->getSchemaManager();
$visitor = new \Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector($this->platform); $visitor = new DropSchemaSqlCollector($this->platform);
/* @var $schema \Doctrine\DBAL\Schema\Schema */ /* @var $schema \Doctrine\DBAL\Schema\Schema */
$schema = $sm->createSchema(); $schema = $sm->createSchema();
......
...@@ -82,7 +82,7 @@ class PoolingShardConnection extends Connection ...@@ -82,7 +82,7 @@ class PoolingShardConnection extends Connection
private $connections; private $connections;
/** /**
* @var PoolingShardManager * @var ShardManager
*/ */
private $shardManager; private $shardManager;
...@@ -192,7 +192,7 @@ class PoolingShardConnection extends Connection ...@@ -192,7 +192,7 @@ class PoolingShardConnection extends Connection
public function isConnected($shardId = null) public function isConnected($shardId = null)
{ {
if ($shardId === null) { if ($shardId === null) {
return ($this->_conn !== null); return $this->_conn !== null;
} }
return isset($this->activeConnections[$shardId]); return isset($this->activeConnections[$shardId]);
...@@ -200,8 +200,8 @@ class PoolingShardConnection extends Connection ...@@ -200,8 +200,8 @@ class PoolingShardConnection extends Connection
public function close() public function close()
{ {
unset($this->_conn); $this->_conn = null;
unset($this->activeConnections); $this->activeConnections = null;
} }
} }
...@@ -30,7 +30,7 @@ use Doctrine\DBAL\Sharding\SingleDatabaseSynchronizer; ...@@ -30,7 +30,7 @@ use Doctrine\DBAL\Sharding\SingleDatabaseSynchronizer;
* SQL Azure Schema Synchronizer * SQL Azure Schema Synchronizer
* *
* Will iterate over all shards when performing schema operations. This is done * Will iterate over all shards when performing schema operations. This is done
* by partioning the passed schema into subschemas for the federation and the * by partitioning the passed schema into subschemas for the federation and the
* global database and then applying the operations step by step using the * global database and then applying the operations step by step using the
* {@see \Doctrine\DBAL\Sharding\SingleDatabaseSynchronizer}. * {@see \Doctrine\DBAL\Sharding\SingleDatabaseSynchronizer}.
* *
...@@ -38,6 +38,9 @@ use Doctrine\DBAL\Sharding\SingleDatabaseSynchronizer; ...@@ -38,6 +38,9 @@ use Doctrine\DBAL\Sharding\SingleDatabaseSynchronizer;
*/ */
class SQLAzureFederationsSynchronizer implements SchemaSynchronizer class SQLAzureFederationsSynchronizer implements SchemaSynchronizer
{ {
const FEDERATION_TABLE_FEDERATED = 'azure.federated';
const FEDERATION_DISTRIBUTION_NAME = 'azure.federatedOnDistributionName';
/** /**
* @var Connection * @var Connection
*/ */
...@@ -53,9 +56,6 @@ class SQLAzureFederationsSynchronizer implements SchemaSynchronizer ...@@ -53,9 +56,6 @@ class SQLAzureFederationsSynchronizer implements SchemaSynchronizer
*/ */
private $synchronizer; private $synchronizer;
const FEDERATION_TABLE_FEDERATED = 'azure.federated';
const FEDERATION_DISTRIBUTION_NAME = 'azure.federatedOnDistributionName';
public function __construct(Connection $conn, SQLAzureShardManager $shardManager, SchemaSynchronizer $sync = null) public function __construct(Connection $conn, SQLAzureShardManager $shardManager, SchemaSynchronizer $sync = null)
{ {
$this->conn = $conn; $this->conn = $conn;
...@@ -63,7 +63,6 @@ class SQLAzureFederationsSynchronizer implements SchemaSynchronizer ...@@ -63,7 +63,6 @@ class SQLAzureFederationsSynchronizer implements SchemaSynchronizer
$this->synchronizer = $sync ?: new SingleDatabaseSynchronizer($conn); $this->synchronizer = $sync ?: new SingleDatabaseSynchronizer($conn);
} }
/** /**
* Get the SQL statements that can be executed to create the schema. * Get the SQL statements that can be executed to create the schema.
* *
......
...@@ -129,7 +129,6 @@ class SQLAzureShardManager implements ShardManager ...@@ -129,7 +129,6 @@ class SQLAzureShardManager implements ShardManager
} }
/** /**
* @override
* {@inheritDoc} * {@inheritDoc}
*/ */
public function selectGlobal() public function selectGlobal()
...@@ -144,7 +143,6 @@ class SQLAzureShardManager implements ShardManager ...@@ -144,7 +143,6 @@ class SQLAzureShardManager implements ShardManager
} }
/** /**
* @override
* {@inheritDoc} * {@inheritDoc}
*/ */
public function selectShard($distributionValue) public function selectShard($distributionValue)
...@@ -171,7 +169,6 @@ class SQLAzureShardManager implements ShardManager ...@@ -171,7 +169,6 @@ class SQLAzureShardManager implements ShardManager
} }
/** /**
* @override
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getCurrentDistributionValue() public function getCurrentDistributionValue()
...@@ -180,7 +177,6 @@ class SQLAzureShardManager implements ShardManager ...@@ -180,7 +177,6 @@ class SQLAzureShardManager implements ShardManager
} }
/** /**
* @override
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getShards() public function getShards()
...@@ -196,7 +192,6 @@ class SQLAzureShardManager implements ShardManager ...@@ -196,7 +192,6 @@ class SQLAzureShardManager implements ShardManager
} }
/** /**
* @override
* {@inheritDoc} * {@inheritDoc}
*/ */
public function queryAll($sql, array $params = array(), array $types = array()) public function queryAll($sql, array $params = array(), array $types = array())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment