diff --git a/src/Illuminate/Database/Connection.php b/src/Illuminate/Database/Connection.php index 0dda1a622a8b..71efec09dfca 100755 --- a/src/Illuminate/Database/Connection.php +++ b/src/Illuminate/Database/Connection.php @@ -49,6 +49,13 @@ class Connection implements ConnectionInterface */ protected $database; + /** + * The type of the connection. + * + * @var string|null + */ + protected $type; + /** * The table prefix for the connection. * @@ -161,13 +168,6 @@ class Connection implements ConnectionInterface */ protected static $resolvers = []; - /** - * The type of the connection. - * - * @var string|null - */ - protected $type; - /** * Create a new database connection instance. * @@ -1057,9 +1057,9 @@ public function getName() * * @return string|null */ - public function getFullName() + public function getNameWithReadWriteType() { - return $this->getName().($this->type ? '::'.$this->type : ''); + return $this->getName().($this->readWriteType ? '::'.$this->readWriteType : ''); } /** @@ -1292,14 +1292,14 @@ public function setDatabaseName($database) } /** - * Set the type of the connection. + * Set the read / write type of the connection. * - * @param string $type + * @param string|null $readWriteType * @return $this */ - public function setType($type) + public function setReadWriteType($readWriteType) { - $this->type = $type; + $this->readWriteType = $readWriteType; return $this; } diff --git a/src/Illuminate/Database/DatabaseManager.php b/src/Illuminate/Database/DatabaseManager.php index 3f426c216ffa..5d2f7cdcb1dd 100755 --- a/src/Illuminate/Database/DatabaseManager.php +++ b/src/Illuminate/Database/DatabaseManager.php @@ -62,7 +62,7 @@ public function __construct($app, ConnectionFactory $factory) $this->factory = $factory; $this->reconnector = function ($connection) { - $this->reconnect($connection->getFullName()); + $this->reconnect($connection->getNameWithReadWriteType()); }; } @@ -165,7 +165,7 @@ protected function configuration($name) */ protected function configure(Connection $connection, $type) { - $connection = $this->setPdoForType($connection, $type)->setType($type); + $connection = $this->setPdoForType($connection, $type)->setReadWriteType($type); // First we'll set the fetch mode and a few other dependencies of the database // connection. This method basically just configures and prepares it to get @@ -282,8 +282,8 @@ protected function refreshPdoConnections($name) ); return $this->connections[$name] - ->setPdo($fresh->getRawPdo()) - ->setReadPdo($fresh->getRawReadPdo()); + ->setPdo($fresh->getRawPdo()) + ->setReadPdo($fresh->getRawReadPdo()); } /**