From 060784adfb15a3136a6c7febbbec5c82290ae425 Mon Sep 17 00:00:00 2001 From: "Jonathan.Wage" Date: Sat, 10 Nov 2007 20:11:17 +0000 Subject: [PATCH] Merge r3127:3129 (fixes #522) --- lib/Doctrine/Task/CreateDb.php | 8 ++++++-- lib/Doctrine/Task/DropDb.php | 8 ++++++-- manual/docs/en/facade.txt | 4 ++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/Doctrine/Task/CreateDb.php b/lib/Doctrine/Task/CreateDb.php index b897e7ddf..a19e6fb0c 100644 --- a/lib/Doctrine/Task/CreateDb.php +++ b/lib/Doctrine/Task/CreateDb.php @@ -37,8 +37,12 @@ class Doctrine_Task_CreateDb extends Doctrine_Task public function execute() { - Doctrine::createDatabases(); + $results = Doctrine::createDatabases(); - $this->notify('Created databases successfully'); + foreach ($results as $dbName => $bool) { + $msg = $bool ? 'Successfully created database named: "' . $dbName . '"':'Could not create database named: "' .$dbName . '"'; + + $this->notify($msg); + } } } \ No newline at end of file diff --git a/lib/Doctrine/Task/DropDb.php b/lib/Doctrine/Task/DropDb.php index f37cb8e70..49fbdeb00 100644 --- a/lib/Doctrine/Task/DropDb.php +++ b/lib/Doctrine/Task/DropDb.php @@ -46,8 +46,12 @@ class Doctrine_Task_DropDb extends Doctrine_Task return; } - Doctrine::dropDatabases(); + $results = Doctrine::dropDatabases(); - $this->notify('Dropped databases successfully'); + foreach ($results as $dbName => $bool) { + $msg = $bool ? 'Successfully dropped database named: "' . $dbName . '"':'Could not drop database named: "' .$dbName . '"'; + + $this->notify($msg); + } } } \ No newline at end of file diff --git a/manual/docs/en/facade.txt b/manual/docs/en/facade.txt index 3392a017f..090bd80af 100644 --- a/manual/docs/en/facade.txt +++ b/manual/docs/en/facade.txt @@ -1,3 +1,7 @@ +++ Creating & Dropping Databases + +Doctrine offers the ability to create and drop your databases from your defined Doctrine connections. The only trick to using it is that the name of your Doctrine connection must be the name of your database. This is required due to the fact that PDO does not offer a method for retrieving the name of the database you are connected to. So in order to create and drop the database Doctrine itself must be aware of the name of the database. + ++ Convenience Methods Doctrine offers static convenience methods available in the main Doctrine class. These methods perform some of the most used functionality of Doctrine with one method. Most of these methods are using in the Doctrine_Task system. These tasks are also what are executed from the Doctrine_Cli.