ModelTask Class Reference

Public Member Functions | |
| 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 36 of file model.php.
Member Function Documentation
| 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 513 of file model.php.
References $filename, Shell::$name, $out, Shell::createFile(), doAssociations(), doValidation(), Shell::out(), Inflector::tableize(), and Inflector::underscore().
Referenced by 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 676 of file model.php.
References Shell::$className, Set::extract(), fixture(), and Inflector::underscore().
Referenced by 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 $bad, Shell::$className, Shell::$interactive, Shell::_modelKey(), Shell::_modelName(), Shell::_modelNameFromKey(), a(), Shell::hr(), App::import(), Shell::in(), low(), Shell::out(), and Inflector::tableize().
Referenced by bake().
| ModelTask::doValidation | ( | &$ | model, | |
| $ | interactive = true | |||
| ) |
Handles associations
- Parameters:
-
object $model boolean $interactive
- Returns:
- array $validate public
Definition at line 225 of file model.php.
References Shell::$interactive, Shell::in(), and Shell::out().
Referenced by bake().
| ModelTask::execute | ( | ) |
Execution method always used for tasks
public
Definition at line 64 of file model.php.
References Shell::_checkUnitTest(), bake(), bakeTest(), and Inflector::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 829 of file model.php.
References $filename, $out, a(), App::import(), Inflector::tableize(), and Inflector::underscore().
Referenced by bakeTest().
| ModelTask::getName | ( | $ | useDbConfig | ) |
| ModelTask::help | ( | ) |
| 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 743 of file model.php.
References config(), and ConnectionManager::getDataSource().
Member Data Documentation
| ModelTask::$tasks = array('DbConfig') |
The documentation for this class was generated from the following file:
- 1.2.x.x/cake/console/libs/tasks/model.php