Class ConsoleShell

Provides a very basic 'interactive' console for CakePHP apps.

AppShell
Extended by ConsoleShell
Package: Cake\Console\Command
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

Method Summary

  • _bind() protected
    Bind an association
  • _columns() protected
    Show the columns for a model
  • _exit() protected
    Set the finiished property so that the loop in main method ends
  • _find() protected
    Perform a find
  • _isValidModel() protected
    Tells 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() protected
    Determine the method to process the current command
  • _models() protected
    List all models
  • _routeToArray() protected
    Parse a string URL and show as an array
  • _routeToString() protected
    Parse an array URL and show the equivalent URL as a string
  • _routesReload() protected
    Reload route definitions
  • _routesShow() protected
    Show all routes
  • _save() protected
    Save a record
  • _unbind() protected
    Unbind an association
  • Gets the option parser instance and configures it.
  • help() public
    Prints the help message
  • main() public
    Override main() to handle action
  • startup() public
    Override 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.

_exit()source protected

_exit( )

Set the finiished property so that the loop in main method ends

_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

boolean
true 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

boolean
True 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

string
or false

_models()source protected

_models( )

List all models

_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.

_routesReload()source protected

_routesReload( )

Reload route definitions

_routesShow()source protected

_routesShow( )

Show all routes

_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

help()source public

help( )

Prints the help message

main()source public

main( string $command null )

Override main() to handle action

Parameters

string $command optional null
The command to run.

startup()source public

startup( )

Override startup of the Shell

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')

$badCommandCharssource

public array

Chars that describe invalid commands

array('$', ';')

$modelssource

public array

Available models

array()

© 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