From 4ce2a36968b8ac2d76e1e1553d8c3d10b59602d6 Mon Sep 17 00:00:00 2001 From: "Jonathan.Wage" Date: Sun, 21 Oct 2007 01:16:04 +0000 Subject: [PATCH] Fix to naming of spyc and update docs for cli. --- lib/Doctrine/Parser/Yml.php | 7 +- lib/Doctrine/Parser/spyc.php | 35 +++--- manual/docs/en/command-line-interface.txt | 138 +++++----------------- 3 files changed, 50 insertions(+), 130 deletions(-) diff --git a/lib/Doctrine/Parser/Yml.php b/lib/Doctrine/Parser/Yml.php index 741485083..cbd5d1d0e 100644 --- a/lib/Doctrine/Parser/Yml.php +++ b/lib/Doctrine/Parser/Yml.php @@ -45,7 +45,7 @@ class Doctrine_Parser_Yml extends Doctrine_Parser */ public function dumpData($array, $path = null) { - $spyc = new DoctrineSpyc(); + $spyc = new Doctrine_Spyc(); $yml = $spyc->dump($array, false, false); @@ -55,6 +55,7 @@ class Doctrine_Parser_Yml extends Doctrine_Parser return $yml; } } + /** * loadData * @@ -68,10 +69,10 @@ class Doctrine_Parser_Yml extends Doctrine_Parser { $contents = $this->getContents($path); - $spyc = new DoctrineSpyc(); + $spyc = new Doctrine_Spyc(); $array = $spyc->load($contents); return $array; } -} +} \ No newline at end of file diff --git a/lib/Doctrine/Parser/spyc.php b/lib/Doctrine/Parser/spyc.php index f974d92a7..d5f0836db 100644 --- a/lib/Doctrine/Parser/spyc.php +++ b/lib/Doctrine/Parser/spyc.php @@ -1,20 +1,22 @@ * @author Vlad Andersen * @link http://spyc.sourceforge.net/ * @copyright Copyright 2005-2006 Chris Wanstrath * @license http://www.opensource.org/licenses/mit-license.php MIT License - * @package DoctrineSpyc + * @package Doctrine + * @subpackage Spyc */ /** - * A node, used by DoctrineSpyc for parsing YAML. - * @package DoctrineSpyc + * A node, used by Doctrine_Spyc for parsing YAML. + * @package Doctrine + * @subpackage Spyc */ - class DoctrineYAMLNode { + class Doctrine_YAMLNode { /**#@+ * @access public * @var string @@ -43,7 +45,7 @@ * @access public * @return void */ - function DoctrineYAMLNode($nodeId) { + function Doctrine_YAMLNode($nodeId) { $this->id = $nodeId; } } @@ -57,12 +59,13 @@ * * Usage: * - * $parser = new DoctrineSpyc; + * $parser = new Doctrine_Spyc; * $array = $parser->load($file); * - * @package DoctrineSpyc + * @package Doctrine + * @subpackage Spyc */ - class DoctrineSpyc { + class Doctrine_Spyc { /** * Load YAML into a PHP array statically @@ -72,7 +75,7 @@ * simple. * Usage: * - * $array = DoctrineSpyc::YAMLLoad('lucky.yaml'); + * $array = Doctrine_Spyc::YAMLLoad('lucky.yaml'); * print_r($array); * * @access public @@ -80,7 +83,7 @@ * @param string $input Path of YAML file or string containing YAML */ function YAMLLoad($input) { - $spyc = new DoctrineSpyc; + $spyc = new Doctrine_Spyc; return $spyc->load($input); } @@ -105,7 +108,7 @@ * @param int $wordwrap Pass in 0 for no wordwrap, false for default (40) */ function YAMLDump($array,$indent = false,$wordwrap = false) { - $spyc = new DoctrineSpyc; + $spyc = new Doctrine_Spyc; return $spyc->dump($array,$indent,$wordwrap); } @@ -116,7 +119,7 @@ * will do its best to convert the YAML into a PHP array. Pretty simple. * Usage: * - * $parser = new DoctrineSpyc; + * $parser = new Doctrine_Spyc; * $array = $parser->load('lucky.yaml'); * print_r($array); * @@ -134,7 +137,7 @@ $yaml = explode("\n",$input); } // Initiate some objects and values - $base = new DoctrineYAMLNode (1); + $base = new Doctrine_YAMLNode (1); $base->indent = 0; $this->_lastIndent = 0; $this->_lastNode = $base->id; @@ -159,7 +162,7 @@ $last->data[key($last->data)] .= "\n"; } elseif ($ifchk{0} != '#' && substr($ifchk,0,3) != '---') { // Create a new node and get its indent - $node = new DoctrineYAMLNode ($this->_nodeId); + $node = new Doctrine_YAMLNode ($this->_nodeId); $this->_nodeId++; $node->indent = $this->_getIndent($line); @@ -866,4 +869,4 @@ return $ret; } } -?> \ No newline at end of file +?> diff --git a/manual/docs/en/command-line-interface.txt b/manual/docs/en/command-line-interface.txt index 0d810fa95..bd8304e44 100644 --- a/manual/docs/en/command-line-interface.txt +++ b/manual/docs/en/command-line-interface.txt @@ -1,119 +1,35 @@ +++ Introduction + +The Doctrine Cli is a collection of tasks that help you with your day to do development and testing with your Doctrine implementation. Typically with the examples in this manual, you setup php scripts to perform whatever tasks you may need. This Cli tool is aimed at providing an out of the box solution for those tasks. + ++ Tasks +Below is a list of available tasks for managing your Doctrine implementation. + -Available Doctrine Command Line Interface Tasks ----------------------------------------- +./cli build-all +./cli build-all-load +./cli build-all-reload +./cli compile +./cli create-db +./cli create-tables +./cli dql +./cli drop-db +./cli dump-data +./cli generate-migration +./cli generate-migrations-from-db +./cli generate-migrations-from-models +./cli generate-models-from-db +./cli generate-models-from-yaml +./cli generate-sql +./cli generate-yaml-from-db +./cli generate-yaml-from-models +./cli load-data +./cli load-dummy-data +./cli migrate +./cli rebuild-db -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.