Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
88bf7c17
Commit
88bf7c17
authored
Jan 16, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new events onConnect and onPreConnect
parent
3c0192db
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
2 deletions
+27
-2
Db.php
lib/Doctrine/Db.php
+6
-0
Event.php
lib/Doctrine/Db/Event.php
+1
-2
EventListener.php
lib/Doctrine/Db/EventListener.php
+5
-0
Chain.php
lib/Doctrine/Db/EventListener/Chain.php
+12
-0
Interface.php
lib/Doctrine/Db/EventListener/Interface.php
+3
-0
No files found.
lib/Doctrine/Db.php
View file @
88bf7c17
...
...
@@ -199,6 +199,10 @@ class Doctrine_Db implements Countable, IteratorAggregate, Doctrine_Adapter_Inte
if
(
$this
->
isConnected
)
return
false
;
$event
=
new
Doctrine_Db_Event
(
$this
,
Doctrine_Db_Event
::
CONNECT
);
$this
->
listener
->
onPreConnect
(
$event
);
$this
->
dbh
=
new
PDO
(
$this
->
options
[
'dsn'
],
$this
->
options
[
'username'
],
$this
->
options
[
'password'
]);
$this
->
dbh
->
setAttribute
(
PDO
::
ATTR_ERRMODE
,
PDO
::
ERRMODE_EXCEPTION
);
$this
->
dbh
->
setAttribute
(
PDO
::
ATTR_STATEMENT_CLASS
,
array
(
'Doctrine_Db_Statement'
,
array
(
$this
)));
...
...
@@ -212,6 +216,8 @@ class Doctrine_Db implements Countable, IteratorAggregate, Doctrine_Adapter_Inte
}
$this
->
isConnected
=
true
;
$this
->
listener
->
onConnect
(
$event
);
return
true
;
}
...
...
lib/Doctrine/Db/Event.php
View file @
88bf7c17
...
...
@@ -38,6 +38,7 @@ class Doctrine_Db_Event
const
BEGIN
=
5
;
const
COMMIT
=
6
;
const
ROLLBACK
=
7
;
const
CONNECT
=
8
;
protected
$invoker
;
protected
$query
;
...
...
@@ -54,8 +55,6 @@ class Doctrine_Db_Event
$this
->
invoker
=
$invoker
;
$this
->
type
=
$type
;
$this
->
query
=
$query
;
}
public
function
getQuery
()
{
...
...
lib/Doctrine/Db/EventListener.php
View file @
88bf7c17
...
...
@@ -31,6 +31,11 @@
*/
class
Doctrine_Db_EventListener
implements
Doctrine_Db_EventListener_Interface
{
public
function
onPreConnect
(
Doctrine_Db_Event
$event
)
{
}
public
function
onConnect
(
Doctrine_Db_Event
$event
)
{
}
public
function
onPreQuery
(
Doctrine_Db_Event
$event
)
{
}
public
function
onQuery
(
Doctrine_Db_Event
$event
)
...
...
lib/Doctrine/Db/EventListener/Chain.php
View file @
88bf7c17
...
...
@@ -67,6 +67,18 @@ class Doctrine_Db_EventListener_Chain extends Doctrine_Access implements Doctrin
$this
->
listeners
[
$name
]
=
$listener
;
}
public
function
onPreConnect
(
Doctrine_Db_Event
$event
)
{
foreach
(
$this
->
listeners
as
$listener
)
{
$listener
->
onPreConnect
(
$event
);
}
}
public
function
onConnect
(
Doctrine_Db_Event
$event
)
{
foreach
(
$this
->
listeners
as
$listener
)
{
$listener
->
onConnect
(
$event
);
}
}
public
function
onQuery
(
Doctrine_Db_Event
$event
)
{
foreach
(
$this
->
listeners
as
$listener
)
{
...
...
lib/Doctrine/Db/EventListener/Interface.php
View file @
88bf7c17
...
...
@@ -26,6 +26,9 @@
* @package Doctrine
*/
interface
Doctrine_Db_EventListener_Interface
{
public
function
onPreConnect
(
Doctrine_Db_Event
$event
);
public
function
onConnect
(
Doctrine_Db_Event
$event
);
public
function
onPreQuery
(
Doctrine_Db_Event
$event
);
public
function
onQuery
(
Doctrine_Db_Event
$event
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment