ModelTask Class Reference

Inheritance diagram for ModelTask:

Shell Object List of all members.

Public Member Functions

 __interactive ()
 bake ($name, $associations=array(), $validate=array(), $primaryKey= 'id', $useTable=null, $useDbConfig= 'default')
 bakeTest ($className, $useTable=null, $associations=array())
 doAssociations (&$model, $interactive=true)
 doValidation (&$model, $interactive=true)
 execute ()
 fixture ($model, $useTable=null)
 getName ($useDbConfig)
 help ()
 listAll ($useDbConfig= 'default', $interactive=true)

Public Attributes

 $path = MODELS
 $plugin = null
 $tasks = array('DbConfig')

Detailed Description

Definition at line 34 of file model.php.


Member Function Documentation

ModelTask::__interactive (  ) 

Handles interactive baking

private

Definition at line 80 of file model.php.

References Shell::$name, __(), Shell::_checkUnitTest(), bake(), bakeTest(), doAssociations(), doValidation(), ConnectionManager::getDataSource(), getName(), Shell::hr(), App::import(), Shell::in(), name(), Shell::out(), and tableize().

Referenced by execute().

ModelTask::bake ( name,
associations = array(),
validate = array(),
primaryKey = 'id',
useTable = null,
useDbConfig = 'default' 
)

Assembles and writes a Model file.

Parameters:
mixed $name Model name or object
mixed $associations if array and $name is not an object assume Model associations array otherwise boolean interactive
array $validate Validation rules
string $primaryKey Primary key to use
string $useTable Table to use
string $useDbConfig Database configuration setting to use private

Definition at line 514 of file model.php.

References $filename, Shell::$name, $out, Shell::createFile(), doAssociations(), doValidation(), Shell::out(), tableize(), and underscore().

Referenced by __interactive(), and execute().

ModelTask::bakeTest ( className,
useTable = null,
associations = array() 
)

Assembles and writes a unit test file

Parameters:
string $className Model class name private

Definition at line 678 of file model.php.

References Shell::$className, Set::extract(), fixture(), and underscore().

Referenced by __interactive(), and execute().

ModelTask::doAssociations ( &$  model,
interactive = true 
)

Handles associations

Parameters:
object $model
boolean $interactive
Returns:
array $assocaitons public

Definition at line 304 of file model.php.

References Shell::$alias, $bad, Shell::$className, Shell::$interactive, __(), Shell::_modelKey(), Shell::_modelName(), Shell::_modelNameFromKey(), a(), Shell::hr(), App::import(), Shell::in(), name(), Shell::out(), and tableize().

Referenced by __interactive(), and bake().

ModelTask::doValidation ( &$  model,
interactive = true 
)

Handles associations

Parameters:
object $model
boolean $interactive
Returns:
array $validate public

Definition at line 222 of file model.php.

References Shell::$interactive, Shell::in(), and Shell::out().

Referenced by __interactive(), and bake().

ModelTask::execute (  ) 

Execution method always used for tasks

public

Definition at line 61 of file model.php.

References __interactive(), Shell::_checkUnitTest(), bake(), bakeTest(), and camelize().

ModelTask::fixture ( model,
useTable = null 
)

Builds the tests fixtures for the model and create the file

Parameters:
string $model the name of the model
string $useTable table name
Returns:
array $records, used in ModelTask::bakeTest() to create $expected
Todo:
move this to a task

Definition at line 833 of file model.php.

References $filename, $out, $path, App::import(), tableize(), and underscore().

Referenced by bakeTest().

ModelTask::getName ( useDbConfig  ) 

Forces the user to specify the model he wants to bake, and returns the selected model name.

Returns:
string the model name public

Definition at line 783 of file model.php.

References __().

Referenced by __interactive().

ModelTask::help (  ) 

Displays help contents

public

Reimplemented from Shell.

Definition at line 815 of file model.php.

ModelTask::listAll ( useDbConfig = 'default',
interactive = true 
)

outputs the a list of possible models or controllers from database

Parameters:
string $useDbConfig Database configuration name public

Definition at line 747 of file model.php.

References __(), config(), and ConnectionManager::getDataSource().


Member Data Documentation

ModelTask::$path = MODELS

Definition at line 48 of file model.php.

ModelTask::$plugin = null

Definition at line 41 of file model.php.

ModelTask::$tasks = array('DbConfig')

Reimplemented from Shell.

Definition at line 55 of file model.php.


The documentation for this class was generated from the following file:
Generated on Sun Nov 22 00:30:56 2009 for CakePHP 1.2.x.x (v1.2.4.8284) by doxygen 1.4.7