You are currently reading the 1.2 documentation. Switch to 2.2  2.1  2.0 

Creating and Dropping Database

When you create connections using Doctrine, you gain the ability to easily create and drop the databases related to those connections.

This is as simple as using some functions provided in the Doctrine_Manager or Doctrine_Connection classes.

The following code will iterate over all instantiated connections and call the dropDatabases()/createDatabases() function on each one:

// test.php

// ...
$manager->createDatabases();

$manager->dropDatabases();

Drop/create database for specific connection

You can easily drop or create the database for a specific Doctrine_Connection instance by calling the dropDatabase()/createDatabase() function on the connection instance with the following code:

// test.php

// ...
$conn->createDatabase();

$conn->dropDatabase();

Questions and Feedback

If you find a problem with the documentation or have a suggestion, please register and open a ticket.

If you need support or have a technical question, you can post to the user mailing-list.