diff --git a/manual/codes/Basic Components - DB - Chaining listeners.php b/manual/codes/Basic Components - Db - Chaining listeners.php similarity index 100% rename from manual/codes/Basic Components - DB - Chaining listeners.php rename to manual/codes/Basic Components - Db - Chaining listeners.php diff --git a/manual/codes/Basic Components - DB - Connecting to a database.php b/manual/codes/Basic Components - Db - Connecting to a database.php similarity index 100% rename from manual/codes/Basic Components - DB - Connecting to a database.php rename to manual/codes/Basic Components - Db - Connecting to a database.php diff --git a/manual/codes/Basic Components - DB - Introduction.php b/manual/codes/Basic Components - Db - Introduction.php similarity index 100% rename from manual/codes/Basic Components - DB - Introduction.php rename to manual/codes/Basic Components - Db - Introduction.php diff --git a/manual/codes/Basic Components - Db - Using event listeners.php b/manual/codes/Basic Components - Db - Using event listeners.php new file mode 100644 index 000000000..43ef6a141 --- /dev/null +++ b/manual/codes/Basic Components - Db - Using event listeners.php @@ -0,0 +1,36 @@ +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! +?>