From 066e7d524f2a2405325fdd3fb2db7728f30ec5e6 Mon Sep 17 00:00:00 2001 From: "Jonathan.Wage" Date: Thu, 18 Oct 2007 04:37:41 +0000 Subject: [PATCH] Initial entry of sandbox and cli manual documentation. --- manual/docs/en.txt | 2 + manual/docs/en/command-line-interface.txt | 171 ++++++++++++++++++++++ manual/docs/en/sandbox.txt | 13 ++ 3 files changed, 186 insertions(+) create mode 100644 manual/docs/en/command-line-interface.txt create mode 100644 manual/docs/en/sandbox.txt diff --git a/manual/docs/en.txt b/manual/docs/en.txt index 65e422129..ae6cf3e4a 100644 --- a/manual/docs/en.txt +++ b/manual/docs/en.txt @@ -1,4 +1,6 @@ + Getting started ++ Sandbox ++ Command Line Interface + Connection management + Basic schema mapping + Relations diff --git a/manual/docs/en/command-line-interface.txt b/manual/docs/en/command-line-interface.txt new file mode 100644 index 000000000..0d810fa95 --- /dev/null +++ b/manual/docs/en/command-line-interface.txt @@ -0,0 +1,171 @@ +++ Tasks + + + +Available Doctrine Command Line Interface Tasks +---------------------------------------- + +Compile doctrine classes in to one single php file +Syntax: ./cli compile + +Arguments (* = required): +drivers - Specify list of drivers you wish to compile. Ex: mysql|mssql|sqlite +compiled_path - The path where you want to write the compiled doctrine libs. + +---------------------------------------- +Create database for each of your connections +Syntax: ./cli create-db + +Arguments (* = required): +connection - Optionally specify a single connection to create the database for. + +---------------------------------------- +Create tables for all existing database connections +Syntax: ./cli create-tables + +Arguments (* = required): +*models_path - Specify path to your models directory. + +---------------------------------------- +Drop database for all existing connections +Syntax: ./cli drop-db + +Arguments (* = required): +connection - Optionally specify a single connection to drop the database for. + +---------------------------------------- +Dump data to a yaml data fixture file. +Syntax: ./cli dump-data + +Arguments (* = required): +*data_fixtures_path - Specify path to write the yaml data fixtures file to. +*models_path - Specify path to your Doctrine_Record definitions. +individual_files - Specify whether or not you want to dump to individual files. One file per model. + +---------------------------------------- +Generate new migration class definition +Syntax: ./cli generate-migration + +Arguments (* = required): +*class_name - Name of the migration class to generate +*migrations_path - Specify the complete path to your migration classes folder. + +---------------------------------------- +Generates your Doctrine_Record definitions from your existing database connections. +Syntax: ./cli generate-models-from-db + +Arguments (* = required): +*models_path - Specify path to your Doctrine_Record definitions. +connection - Optionally specify a single connection to generate the models for. + +---------------------------------------- +Generates your Doctrine_Record definitions from a Yaml schema file +Syntax: ./cli generate-models-from-yaml + +Arguments (* = required): +*yaml_schema_path - Specify the complete directory path to your yaml schema files. +*models_path - Specify complete path to your Doctrine_Record definitions. + +---------------------------------------- +Generate sql for all existing database connections. +Syntax: ./cli generate-sql + +Arguments (* = required): +*models_path - Specify complete path to your Doctrine_Record definitions. +*sql_path - Path to write the generated sql. + +---------------------------------------- +Generates a Yaml schema file from an existing database +Syntax: ./cli generate-yaml-from-db + +Arguments (* = required): +*yaml_schema_path - Specify the path to your yaml schema files. + +---------------------------------------- +Generates a Yaml schema file from existing Doctrine_Record definitions +Syntax: ./cli generate-yaml-from-models + +Arguments (* = required): +*yaml_schema_path - Specify the complete directory path to your yaml schema files. +*models_path - Specify complete path to your Doctrine_Record definitions. + +---------------------------------------- +Load data from a yaml data fixture file. +Syntax: ./cli load-data + +Arguments (* = required): +*data_fixtures_path - Specify the complete path to load the yaml data fixtures files from. +*models_path - Specify path to your Doctrine_Record definitions. + +---------------------------------------- +Load data from a yaml data fixture file. +Syntax: ./cli load-dummy-data + +Arguments (* = required): +*models_path - Specify path to your Doctrine_Record definitions. +append - Whether or not to append the data or to delete all data before loading. +num - Number of records to populate for each model. + +---------------------------------------- +Migrate database to latest version or the specified version +Syntax: ./cli migrate + +Arguments (* = required): +version - Version to migrate to. If you do not specify, the db will be migrated from the current version to the latest. + +---------------------------------------- + + +The tasks for the CLI are separate from the CLI and can be used standalone. Below is an example. + + +$task = new Doctrine_Task_GenerateModelsFromYaml(); + +$args = array('yaml_schema_path' => '/path/to/schema', + 'models_path' => '/path/to/models'); + +$task->setArguments($args); + +try { + if ($task->validate()) { + $task->execute(); + } +} catch (Exception $e) { + throw new Doctrine_Cli_Exception($e->getMessage()); +} + + +++ Usage + +File named "cli" that is set to executable + + +#!/usr/bin/env php + + +Actual php file named "cli.php" that implements the Doctrine_Cli. + +// Include your Doctrine configuration/setup here, your connections, models, etc. + +// Configure Doctrine Cli +// Normally these are arguments to the cli tasks but if they are set here the arguments will be auto-filled and are not required for you to enter them. + +$config = array('data_fixtures_path' => '/path/to/data/fixtures', + 'models_path' => '/path/to/models', + 'migrations_path' => '/path/to/migrations', + 'sql_path' => '/path/to/data/sql', + 'yaml_schema_path' => '/path/to/schema'); + +$cli = new Doctrine_Cli($config); +$cli->run($_SERVER['argv']); + + +Now you can begin executing commands. + + +./cli generate-models-from-yaml +./cli create-tables + \ No newline at end of file diff --git a/manual/docs/en/sandbox.txt b/manual/docs/en/sandbox.txt new file mode 100644 index 000000000..d91d505b4 --- /dev/null +++ b/manual/docs/en/sandbox.txt @@ -0,0 +1,13 @@ +++ Installation + +Currently the only way you can install and use the sandbox is by svn. It is available by checking out the trunk of Doctrine. The sandbox comes loaded with generated models, sample schema files, data fixtures and a portable sqlite database to play with. + + +svn co http://doctrine.pengus.net/svn/trunk doctrine_trunk +cd doctrine_trunk/sandbox +chmod 0777 cli + +./cli + + +The above steps should give you a functioning sandbox. Execute the ./cli command without specifying a task will show you an index of all the available cli tasks in Doctrine. \ No newline at end of file