Skip to content

Commit d4574c2

Browse files
committed
Merge pull request #2732 from thewilkybarkid/session-pdo-exception
Session PDO error handling
2 parents 527b034 + 14aff92 commit d4574c2

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+
<call method="setAttribute">
77+
<argument type="constant">PDO::ATTR_ERRMODE</argument>
78+
<argument type="constant">PDO::ERRMODE_EXCEPTION</argument>
79+
</call>
7480
</service>
7581
7682
<service id="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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy