Class ControllerTask
Task class for creating and updating controller files.
- AppShell
- BakeTask
- ControllerTask
Copyright: Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: Cake/Console/Command/Task/ControllerTask.php
Properties summary
Inherited Properties
Method Summary
-
_askAboutMethods() protected
Interact with the user and ask about which methods (admin or regular they want to bake) -
_doPropertyChoices() protected
Common code for property choice handling. -
_interactive() protected
Interactive -
all() public
Bake All the controllers at once. Will only bake controllers for models that exist. -
bake() public
Assembles and writes a Controller file -
bakeActions() public
Bake scaffold actions -
bakeTest() public
Assembles and writes a unit test file -
confirmController() public
Confirm a to be baked controller with the user -
doComponents() public
Interact with the user and get a list of additional components -
doHelpers() public
Interact with the user and get a list of additional helpers -
execute() public
Execution method always used for tasks -
getName() public
Forces the user to specify the controller he wants to bake, and returns the selected controller name. -
getOptionParser() public
get the option parser. -
help() public
Displays help contents -
initialize() public
Override initialize -
listAll() public
Outputs and gets the list of possible controllers from database
Method Detail
_askAboutMethods() protected ¶
_askAboutMethods( )
Interact with the user and ask about which methods (admin or regular they want to bake)
Returns
Array containing (bakeRegular, bakeAdmin) answers
_doPropertyChoices() protected ¶
_doPropertyChoices( string $prompt , string $example )
Common code for property choice handling.
Parameters
- string $prompt
- A yes/no question to precede the list
- string $example
- A question for a comma separated list, with examples.
Returns
Array of values for property.
all() public ¶
all( )
Bake All the controllers at once. Will only bake controllers for models that exist.
bake() public ¶
bake( string $controllerName , string $actions = '' , array $helpers = null , array $components = null )
Assembles and writes a Controller file
Parameters
- string $controllerName
- Controller name already pluralized and correctly cased.
- string $actions optional ''
- Actions to add, or set the whole controller to use $scaffold (set $actions to 'scaffold')
- array $helpers optional null
- Helpers to use in controller
- array $components optional null
- Components to use in controller
Returns
Baked controller
bakeActions() public ¶
bakeActions( string $controllerName , string $admin = null , boolean $wannaUseSession = true )
Bake scaffold actions
Parameters
- string $controllerName
- Controller name
- string $admin optional null
- Admin route to use
- boolean $wannaUseSession optional true
- Set to true to use sessions, false otherwise
Returns
Baked actions
bakeTest() public ¶
bakeTest( string $className )
Assembles and writes a unit test file
Parameters
- string $className
- Controller class name
Returns
Baked test
confirmController() public ¶
confirmController( string $controllerName , string $useDynamicScaffold , array $helpers , array $components )
Confirm a to be baked controller with the user
Parameters
- string $controllerName
- string $useDynamicScaffold
- array $helpers
- array $components
doComponents() public ¶
doComponents( )
Interact with the user and get a list of additional components
Returns
Components the user wants to use.
doHelpers() public ¶
doHelpers( )
Interact with the user and get a list of additional helpers
Returns
Helpers that the user wants to use.