Skip to content

Commit

Permalink
Merge pull request #36 from RamyHakam/35-doctrine-dbal-4-multiple-cha…
Browse files Browse the repository at this point in the history
…nges-and-deprecations

35-doctrine-dbal-4-multiple-changes-and-deprecations
  • Loading branch information
RamyHakam authored Apr 24, 2024
2 parents f228a52 + 1b9c94a commit ca09573
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/Doctrine/DBAL/TenantConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
namespace Hakam\MultiTenancyBundle\Doctrine\DBAL;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Events;
use Doctrine\DBAL\Event;
use Doctrine\DBAL\Exception;

/**
Expand All @@ -20,20 +18,17 @@ class TenantConnection extends Connection
protected bool $autoCommit = true;

/**
* @param array $params
* @return bool
* @throws Exception
* @throws \Doctrine\DBAL\Driver\Exception
*/
public function switchConnection(array $params): bool
{
$this->_conn = $this->_driver->connect($params);

$this->_conn = property_exists($this, 'driver') ? $this->driver->connect($params) : $this->_driver->connect($params);
if ($this->autoCommit === false) {
$this->beginTransaction();
}
if ($this->_eventManager->hasListeners(Events::postConnect)) {
$eventArgs = new Event\ConnectionEventArgs($this);
$this->_eventManager->dispatchEvent(Events::postConnect, $eventArgs);
}
return true;
}

Expand Down

0 comments on commit ca09573

Please sign in to comment.