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
*/
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
<?php
/**
* DoctrineSpyc -- A Simple PHP YAML Class
* Spyc -- A Simple PHP YAML Class
* @version 0.2.(5) -- 2006-12-31
* @author Chris Wanstrath <chris@ozmm.org>
* @author Vlad Andersen <vlad@oneiros.ru>
* @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:
* <code>
* $parser = new DoctrineSpyc;
* $parser = new Doctrine_Spyc;
* $array = $parser->load($file);
* </code>
* @package DoctrineSpyc
* @package Doctrine
* @subpackage Spyc
*/
class DoctrineSpyc {
class Doctrine_Spyc {
/**
* Load YAML into a PHP array statically
......@@ -72,7 +75,7 @@
* simple.
* Usage:
* <code>
* $array = DoctrineSpyc::YAMLLoad('lucky.yaml');
* $array = Doctrine_Spyc::YAMLLoad('lucky.yaml');
* print_r($array);
* </code>
* @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:
* <code>
* $parser = new DoctrineSpyc;
* $parser = new Doctrine_Spyc;
* $array = $parser->load('lucky.yaml');
* print_r($array);
* </code>
......@@ -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
?>
++ Tasks
<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.
++ Introduction
----------------------------------------
Generates your Doctrine_Record definitions from your existing database connections.
Syntax: ./cli generate-models-from-db <models_path> <connection>
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.
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 <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>
++ Tasks
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.
Below is a list of available tasks for managing your Doctrine implementation.
----------------------------------------
Migrate database to latest version or the specified version
Syntax: ./cli migrate <version>
<code>
Arguments (* = required):
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
./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>
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