Commit 4ce2a369 authored by Jonathan.Wage's avatar Jonathan.Wage

Fix to naming of spyc and update docs for cli.

parent e2a204e0
...@@ -45,7 +45,7 @@ class Doctrine_Parser_Yml extends Doctrine_Parser ...@@ -45,7 +45,7 @@ class Doctrine_Parser_Yml extends Doctrine_Parser
*/ */
public function dumpData($array, $path = null) public function dumpData($array, $path = null)
{ {
$spyc = new DoctrineSpyc(); $spyc = new Doctrine_Spyc();
$yml = $spyc->dump($array, false, false); $yml = $spyc->dump($array, false, false);
...@@ -55,6 +55,7 @@ class Doctrine_Parser_Yml extends Doctrine_Parser ...@@ -55,6 +55,7 @@ class Doctrine_Parser_Yml extends Doctrine_Parser
return $yml; return $yml;
} }
} }
/** /**
* loadData * loadData
* *
...@@ -68,7 +69,7 @@ class Doctrine_Parser_Yml extends Doctrine_Parser ...@@ -68,7 +69,7 @@ class Doctrine_Parser_Yml extends Doctrine_Parser
{ {
$contents = $this->getContents($path); $contents = $this->getContents($path);
$spyc = new DoctrineSpyc(); $spyc = new Doctrine_Spyc();
$array = $spyc->load($contents); $array = $spyc->load($contents);
......
<?php <?php
/** /**
* DoctrineSpyc -- A Simple PHP YAML Class * Spyc -- A Simple PHP YAML Class
* @version 0.2.(5) -- 2006-12-31 * @version 0.2.(5) -- 2006-12-31
* @author Chris Wanstrath <chris@ozmm.org> * @author Chris Wanstrath <chris@ozmm.org>
* @author Vlad Andersen <vlad@oneiros.ru> * @author Vlad Andersen <vlad@oneiros.ru>
* @link http://spyc.sourceforge.net/ * @link http://spyc.sourceforge.net/
* @copyright Copyright 2005-2006 Chris Wanstrath * @copyright Copyright 2005-2006 Chris Wanstrath
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @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. * A node, used by Doctrine_Spyc for parsing YAML.
* @package DoctrineSpyc * @package Doctrine
* @subpackage Spyc
*/ */
class DoctrineYAMLNode { class Doctrine_YAMLNode {
/**#@+ /**#@+
* @access public * @access public
* @var string * @var string
...@@ -43,7 +45,7 @@ ...@@ -43,7 +45,7 @@
* @access public * @access public
* @return void * @return void
*/ */
function DoctrineYAMLNode($nodeId) { function Doctrine_YAMLNode($nodeId) {
$this->id = $nodeId; $this->id = $nodeId;
} }
} }
...@@ -57,12 +59,13 @@ ...@@ -57,12 +59,13 @@
* *
* Usage: * Usage:
* <code> * <code>
* $parser = new DoctrineSpyc; * $parser = new Doctrine_Spyc;
* $array = $parser->load($file); * $array = $parser->load($file);
* </code> * </code>
* @package DoctrineSpyc * @package Doctrine
* @subpackage Spyc
*/ */
class DoctrineSpyc { class Doctrine_Spyc {
/** /**
* Load YAML into a PHP array statically * Load YAML into a PHP array statically
...@@ -72,7 +75,7 @@ ...@@ -72,7 +75,7 @@
* simple. * simple.
* Usage: * Usage:
* <code> * <code>
* $array = DoctrineSpyc::YAMLLoad('lucky.yaml'); * $array = Doctrine_Spyc::YAMLLoad('lucky.yaml');
* print_r($array); * print_r($array);
* </code> * </code>
* @access public * @access public
...@@ -80,7 +83,7 @@ ...@@ -80,7 +83,7 @@
* @param string $input Path of YAML file or string containing YAML * @param string $input Path of YAML file or string containing YAML
*/ */
function YAMLLoad($input) { function YAMLLoad($input) {
$spyc = new DoctrineSpyc; $spyc = new Doctrine_Spyc;
return $spyc->load($input); return $spyc->load($input);
} }
...@@ -105,7 +108,7 @@ ...@@ -105,7 +108,7 @@
* @param int $wordwrap Pass in 0 for no wordwrap, false for default (40) * @param int $wordwrap Pass in 0 for no wordwrap, false for default (40)
*/ */
function YAMLDump($array,$indent = false,$wordwrap = false) { function YAMLDump($array,$indent = false,$wordwrap = false) {
$spyc = new DoctrineSpyc; $spyc = new Doctrine_Spyc;
return $spyc->dump($array,$indent,$wordwrap); return $spyc->dump($array,$indent,$wordwrap);
} }
...@@ -116,7 +119,7 @@ ...@@ -116,7 +119,7 @@
* will do its best to convert the YAML into a PHP array. Pretty simple. * will do its best to convert the YAML into a PHP array. Pretty simple.
* Usage: * Usage:
* <code> * <code>
* $parser = new DoctrineSpyc; * $parser = new Doctrine_Spyc;
* $array = $parser->load('lucky.yaml'); * $array = $parser->load('lucky.yaml');
* print_r($array); * print_r($array);
* </code> * </code>
...@@ -134,7 +137,7 @@ ...@@ -134,7 +137,7 @@
$yaml = explode("\n",$input); $yaml = explode("\n",$input);
} }
// Initiate some objects and values // Initiate some objects and values
$base = new DoctrineYAMLNode (1); $base = new Doctrine_YAMLNode (1);
$base->indent = 0; $base->indent = 0;
$this->_lastIndent = 0; $this->_lastIndent = 0;
$this->_lastNode = $base->id; $this->_lastNode = $base->id;
...@@ -159,7 +162,7 @@ ...@@ -159,7 +162,7 @@
$last->data[key($last->data)] .= "\n"; $last->data[key($last->data)] .= "\n";
} elseif ($ifchk{0} != '#' && substr($ifchk,0,3) != '---') { } elseif ($ifchk{0} != '#' && substr($ifchk,0,3) != '---') {
// Create a new node and get its indent // Create a new node and get its indent
$node = new DoctrineYAMLNode ($this->_nodeId); $node = new Doctrine_YAMLNode ($this->_nodeId);
$this->_nodeId++; $this->_nodeId++;
$node->indent = $this->_getIndent($line); $node->indent = $this->_getIndent($line);
......
++ Tasks ++ Introduction
<code>
Available Doctrine Command Line Interface Tasks
----------------------------------------
Compile doctrine classes in to one single php file
Syntax: ./cli compile <drivers> <compiled_path>
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 <connection>
Arguments (* = required):
connection - Optionally specify a single connection to create the database for.
----------------------------------------
Create tables for all existing database connections
Syntax: ./cli create-tables <models_path>
Arguments (* = required):
*models_path - Specify path to your models directory.
----------------------------------------
Drop database for all existing connections
Syntax: ./cli drop-db <connection>
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 <data_fixtures_path> <models_path> <individual_files>
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 <class_name> <migrations_path>
Arguments (* = required):
*class_name - Name of the migration class to generate
*migrations_path - Specify the complete path to your migration classes folder.
---------------------------------------- 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.
Generates your Doctrine_Record definitions from your existing database connections.
Syntax: ./cli generate-models-from-db <models_path> <connection>
Arguments (* = required): ++ Tasks
*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 <yaml_schema_path> <models_path>
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 <models_path> <sql_path>
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 <yaml_schema_path>
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 <yaml_schema_path> <models_path>
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 <data_fixtures_path> <models_path>
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 <models_path> <append> <num>
Arguments (* = required): Below is a list of available tasks for managing your Doctrine implementation.
*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.
---------------------------------------- <code>
Migrate database to latest version or the specified version
Syntax: ./cli migrate <version>
Arguments (* = required): ./cli build-all
version - Version to migrate to. If you do not specify, the db will be migrated from the current version to the latest. ./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
----------------------------------------
</code> </code>
The tasks for the CLI are separate from the CLI and can be used standalone. Below is an example. The tasks for the CLI are separate from the CLI and can be used standalone. Below is an example.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment