10.04.2018 Views

Doctrine_manual-1-2-en

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 26: Utilities 352<br />

Listing<br />

26-24<br />

// Run a migration process for a set of migration classes<br />

$num = 5; // migrate to version #5<br />

<strong>Doctrine</strong>_Core::migration('/path/to/migrations', $num);<br />

// G<strong>en</strong>erate a blank migration class template<br />

<strong>Doctrine</strong>_Core::g<strong>en</strong>erateMigrationClass('ClassName', '/path/to/migrations');<br />

// G<strong>en</strong>erate all migration classes for an existing database<br />

<strong>Doctrine</strong>_Core::g<strong>en</strong>erateMigrationsFromDb('/path/to/migrations');<br />

// G<strong>en</strong>erate all migration classes for an existing set of models<br />

// 2nd argum<strong>en</strong>t is optional if you have already loaded your models using<br />

loadModels()<br />

<strong>Doctrine</strong>_Core::g<strong>en</strong>erateMigrationsFromModels('/path/to/migrations', '/path/<br />

to/models');<br />

// Get <strong>Doctrine</strong>_Table instance for a model<br />

$userTable = <strong>Doctrine</strong>_Core::getTable('User');<br />

// Compile doctrine in to a single php file<br />

$drivers = array('mysql'); // specify the array of drivers you want to<br />

include in this compiled version<br />

<strong>Doctrine</strong>_Core::compile('/path/to/write/compiled/doctrine', $drivers);<br />

// Dump doctrine objects for debugging<br />

$conn = <strong>Doctrine</strong>_Manager::connection();<br />

<strong>Doctrine</strong>_Core::dump($conn);<br />

Tasks<br />

Tasks are classes which bundle some of the core conv<strong>en</strong>i<strong>en</strong>ce methods in to tasks that can be<br />

easily executed by setting the required argum<strong>en</strong>ts. These tasks are directly used in the<br />

<strong>Doctrine</strong> command line interface.<br />

BuildAll<br />

BuildAllLoad<br />

BuildAllReload<br />

Compile<br />

CreateDb<br />

CreateTables<br />

Dql<br />

DropDb<br />

DumpData<br />

Exception<br />

G<strong>en</strong>erateMigration<br />

G<strong>en</strong>erateMigrationsDb<br />

G<strong>en</strong>erateMigrationsModels<br />

G<strong>en</strong>erateModelsDb<br />

G<strong>en</strong>erateModelsYaml<br />

G<strong>en</strong>erateSql<br />

G<strong>en</strong>erateYamlDb<br />

G<strong>en</strong>erateYamlModels<br />

LoadData<br />

Migrate<br />

RebuildDb<br />

----------------- Brought to you by

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!