Task class for creating and updating model files.
$_modelNames
protected array
$_tables
protected array
$_validations
protected array
$path
public string
$skipTables
public array
$tasks
public array
Get an Array of all the tables in the supplied connection will halt the script if no tables are found.
_generatePossibleKeys( )
Finds all possible keys to use on custom associations.
_getModelObject( string $className , string $table null )
Get a model object for a class name.
$className
$table
optional null Model
_printAssociation( string $modelName , string $type , string $associations )
Print out all the associations of a particular type
$modelName
$type
$associations
bake( string|object $name , array|boolean $data array() )
Assembles and writes a Model file.
$name
$data
optional array() bakeFixture( string $className , string $useTable null )
Interact with FixtureTask to automatically bake fixtures when baking models.
$className
$useTable
optional null bakeTest( string $className )
Assembles and writes a unit test file
$className
confirmAssociations( Model $model , array $associations )
Interact with the user and confirm associations.
Model
$model
$associations
doActsAs( Model $model )
Handles behaviors
Model
$model
doAssociations( Model $model )
Handles associations
Model
$model
doMoreAssociations( Model $model , array $associations )
Interact with the user and generate additional non-conventional associations
Model
$model
$associations
doValidation( Model $model )
Handles Generation and user interaction for creating validation.
Model
$model
execute( )
Execution method always used for tasks
BakeTask::execute()
fieldValidation( string $fieldName , array $metaData , string $primaryKey 'id' )
Does individual field validation handling.
$fieldName
$metaData
$primaryKey
optional 'id' findBelongsTo( Model $model , array $associations )
Find belongsTo relations and add them to the associations list.
Model
$model
$associations
findDisplayField( array $fields )
interact with the user to find the displayField value for a model.
$fields
findHasAndBelongsToMany( Model $model , array $associations )
Find the hasAndBelongsToMany relations and add them to associations list
Model
$model
$associations
findHasOneAndMany( Model $model , array $associations )
Find the hasOne and hasMany relations and add them to associations list
Model
$model
$associations
findPrimaryKey( array $fields )
Finds a primary Key in a list of fields.
$fields
getAllTables( string $useDbConfig null )
Get an Array of all the tables in the supplied connection will halt the script if no tables are found.
$useDbConfig
optional null getName( string $useDbConfig null )
Forces the user to specify the model he wants to bake, and returns the selected model name.
$useDbConfig
optional null getOptionParser( )
Gets the option parser instance and configures it.
ConsoleOptionParser
getTable( string $modelName , string $useDbConfig null )
Interact with the user to determine the table name of a particular model
$modelName
$useDbConfig
optional null inOptions( array $options , string $prompt null , integer $default null )
Generate a key value list of options and a prompt.
$options
$prompt
optional null $default
optional null listAll( string $useDbConfig null )
outputs the a list of possible models or controllers from database
$useDbConfig
optional null getPath( )
Gets the path for output. Checks the plugin property and returns the correct path.
startup( )
Disable caching and enable debug for baking. This forces the most current database schema to be used.
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/2.9/class-ModelTask.html