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
30854132
Commit
30854132
authored
Nov 11, 2006
by
pookey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renaming manual files
parent
27622180
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
0 deletions
+36
-0
Basic Components - Db - Chaining listeners.php
manual/codes/Basic Components - Db - Chaining listeners.php
+0
-0
Basic Components - Db - Connecting to a database.php
...odes/Basic Components - Db - Connecting to a database.php
+0
-0
Basic Components - Db - Introduction.php
manual/codes/Basic Components - Db - Introduction.php
+0
-0
Basic Components - Db - Using event listeners.php
...l/codes/Basic Components - Db - Using event listeners.php
+36
-0
No files found.
manual/codes/Basic Components - D
B
- Chaining listeners.php
→
manual/codes/Basic Components - D
b
- Chaining listeners.php
View file @
30854132
File moved
manual/codes/Basic Components - D
B
- Connecting to a database.php
→
manual/codes/Basic Components - D
b
- Connecting to a database.php
View file @
30854132
File moved
manual/codes/Basic Components - D
B
- Introduction.php
→
manual/codes/Basic Components - D
b
- Introduction.php
View file @
30854132
File moved
manual/codes/Basic Components - Db - Using event listeners.php
0 → 100644
View file @
30854132
<?php
// using PDO dsn for connecting sqlite memory table
$dbh
=
Doctrine_Db
::
getConnection
(
'sqlite::memory:'
);
class
MyLogger
extends
Doctrine_Db_EventListener
{
public
function
onPreQuery
(
Doctrine_Db_Event
$event
)
{
print
"database is going to be queried!"
;
}
public
function
onQuery
(
Doctrine_Db_Event
$event
)
{
print
"executed: "
.
$event
->
getQuery
();
}
}
$dbh
->
setListener
(
new
MyLogger
());
$dbh
->
query
(
"SELECT * FROM foo"
);
// prints:
// database is going to be queried
// executed: SELECT * FROM foo
class
MyLogger2
extends
Doctrine_Overloadable
{
public
function
__call
(
$m
,
$a
)
{
print
$m
.
" called!"
;
}
}
$dbh
->
setListener
(
new
MyLogger2
());
$dbh
->
exec
(
"DELETE FROM foo"
);
// prints:
// onPreExec called!
// onExec called!
?>
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