-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate extension via connection events
- Loading branch information
Showing
17 changed files
with
130 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/Driver/AbstractSQLiteDriver/Middleware/EnableForeignKeys.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Doctrine\DBAL\Driver\AbstractSQLiteDriver\Middleware; | ||
|
||
use Doctrine\DBAL\Driver; | ||
use Doctrine\DBAL\Driver\Connection; | ||
use Doctrine\DBAL\Driver\Middleware; | ||
use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware; | ||
|
||
class EnableForeignKeys implements Middleware | ||
{ | ||
public function wrap(Driver $driver): Driver | ||
{ | ||
return new class ($driver) extends AbstractDriverMiddleware { | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function connect(array $params): Connection | ||
{ | ||
$connection = parent::connect($params); | ||
|
||
$connection->exec('PRAGMA foreign_keys=ON'); | ||
|
||
return $connection; | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace Doctrine\DBAL\Driver\OCI8\Middleware; | ||
|
||
use Doctrine\DBAL\Driver; | ||
use Doctrine\DBAL\Driver\Connection; | ||
use Doctrine\DBAL\Driver\Middleware; | ||
use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware; | ||
|
||
class InitializeSession implements Middleware | ||
{ | ||
public function wrap(Driver $driver): Driver | ||
{ | ||
return new class ($driver) extends AbstractDriverMiddleware { | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function connect(array $params): Connection | ||
{ | ||
$connection = parent::connect($params); | ||
|
||
$connection->exec( | ||
'ALTER SESSION SET' | ||
. " NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'" | ||
. " NLS_TIME_FORMAT = 'HH24:MI:SS'" | ||
. " NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'" | ||
. " NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'" | ||
. " NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH24:MI:SS TZH:TZM'" | ||
. " NLS_NUMERIC_CHARACTERS = '.,'", | ||
); | ||
|
||
return $connection; | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters