Class ConsoleShell
Provides a very basic 'interactive' console for CakePHP apps.
- AppShell
- ConsoleShell
Deprecated: 3.0.0 Deprecated since version 2.4, will be removed in 3.0
Copyright: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
License: MIT License
Location: Cake/Console/Command/ConsoleShell.php
Properties summary
-
$_finished
protected_finishedmixed
-
$_methodPatterns
protected_methodPatternsarray
-
$associations
publicAvailable binding typesarray
-
$badCommandChars
publicChars that describe invalid commandsarray
-
$models
publicAvailable modelsarray
Method Summary
- _bind() protectedBind an association
- _columns() protectedShow the columns for a model
- _exit() protectedSet the finiished property so that the loop in main method ends
- _find() protectedPerform a find
- _isValidModel() protectedTells if the specified model is included in the list of available models
- _loadRoutes() protected
Reloads the routes configuration from app/Config/routes.php, and compiles all routes found
- _method() protectedDetermine the method to process the current command
- _models() protectedList all models
- _routeToArray() protectedParse a string URL and show as an array
- _routeToString() protectedParse an array URL and show the equivalent URL as a string
- _routesReload() protectedReload route definitions
- _routesShow() protectedShow all routes
- _save() protectedSave a record
- _unbind() protectedUnbind an association
- getOptionParser() publicGets the option parser instance and configures it.
- help() publicPrints the help message
- main() publicOverride main() to handle action
- startup() publicOverride startup of the Shell
Method Detail
_bind()source protected
_bind( mixed $command )
Bind an association
Parameters
- mixed
$command
- The command to run.
_columns()source protected
_columns( mixed $command )
Show the columns for a model
Parameters
- mixed
$command
- The command to run.
_find()source protected
_find( mixed $command )
Perform a find
Parameters
- mixed
$command
- The command to run.
_isValidModel()source protected
_isValidModel( string $modelToCheck )
Tells if the specified model is included in the list of available models
Parameters
- string
$modelToCheck
- The model to check.
Returns
booleantrue if is an available model, false otherwise
_loadRoutes()source protected
_loadRoutes( )
Reloads the routes configuration from app/Config/routes.php, and compiles all routes found
Returns
booleanTrue if config reload was a success, otherwise false
_method()source protected
_method( string $command )
Determine the method to process the current command
Parameters
- string
$command
- The command to run.
Returns
stringor false
_routeToArray()source protected
_routeToArray( mixed $command )
Parse a string URL and show as an array
Parameters
- mixed
$command
- The command to run.
_routeToString()source protected
_routeToString( mixed $command )
Parse an array URL and show the equivalent URL as a string
Parameters
- mixed
$command
- The command to run.
_save()source protected
_save( mixed $command )
Save a record
Parameters
- mixed
$command
- The command to run.
_unbind()source protected
_unbind( mixed $command )
Unbind an association
Parameters
- mixed
$command
- The command to run.
getOptionParser()source public
getOptionParser( )
Gets the option parser instance and configures it.
Returns
ConsoleOptionParser
main()source public
main( string $command null )
Override main() to handle action
Parameters
- string
$command
optional null - The command to run.
Properties detail
$_finishedsource
protected mixed
_finished
This shell is perpetual, setting this property to true exits the process
false
$_methodPatternssource
protected array
_methodPatterns
array( 'help' => '/^(help|\?)/', '_exit' => '/^(quit|exit)/', '_models' => '/^models/i', '_bind' => '/^(\w+) bind (\w+) (\w+)/', '_unbind' => '/^(\w+) unbind (\w+) (\w+)/', '_find' => '/.+->find/', '_save' => '/.+->save/', '_columns' => '/^(\w+) columns/', '_routesReload' => '/^routes\s+reload/i', '_routesShow' => '/^routes\s+show/i', '_routeToString' => '/^route\s+(\(.*\))$/i', '_routeToArray' => '/^route\s+(.*)$/i', )
$associationssource
public array
Available binding types
array('hasOne', 'hasMany', 'belongsTo', 'hasAndBelongsToMany')
© 2005–2017 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.10/class-ConsoleShell.html