Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd4574c2

Browse files
committed
Merge pull request#2732 from thewilkybarkid/session-pdo-exception
Session PDO error handling
2 parents527b034 +14aff92 commitd4574c2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

‎cookbook/configuration/pdo_session_storage.rst‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ configuration format of your choice):
4545
dsn:"mysql:dbname=mydatabase"
4646
user:myuser
4747
password:mypassword
48+
calls:
49+
-[setAttribute, [3, 2]]# \PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION
4850
4951
session.handler.pdo:
5052
class:Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler
@@ -71,6 +73,10 @@ configuration format of your choice):
7173
<argument>mysql:dbname=mydatabase</argument>
7274
<argument>myuser</argument>
7375
<argument>mypassword</argument>
76+
<callmethod="setAttribute">
77+
<argumenttype="constant">PDO::ATTR_ERRMODE</argument>
78+
<argumenttype="constant">PDO::ERRMODE_EXCEPTION</argument>
79+
</call>
7480
</service>
7581
7682
<serviceid="session.handler.pdo"class="Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler">
@@ -105,6 +111,7 @@ configuration format of your choice):
105111
'myuser',
106112
'mypassword',
107113
));
114+
$pdoDefinition->addMethodCall('setAttribute', array(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION));
108115
$container->setDefinition('pdo', $pdoDefinition);
109116
110117
$storageDefinition = new Definition('Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler', array(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp