Skip to content

Commit

Permalink
formatting'
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed May 25, 2021
1 parent a0f6ff6 commit d1a32f9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
26 changes: 13 additions & 13 deletions src/Illuminate/Database/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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 : '');
}

/**
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/Database/DatabaseManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
};
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -282,8 +282,8 @@ protected function refreshPdoConnections($name)
);

return $this->connections[$name]
->setPdo($fresh->getRawPdo())
->setReadPdo($fresh->getRawReadPdo());
->setPdo($fresh->getRawPdo())
->setReadPdo($fresh->getRawReadPdo());
}

/**
Expand Down

0 comments on commit d1a32f9

Please sign in to comment.