Class ControllerTask
Task class for creating and updating controller files.
- AppShell
- 
			 BakeTask BakeTask
- 
			 ControllerTask ControllerTask
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/Console/Command/Task/ControllerTask.php
Properties summary
Inherited Properties
Method Summary
- 
			_askAboutMethods() protectedInteract with the user and ask about which methods (admin or regular they want to bake)
- 
			_doPropertyChoices() protectedCommon code for property choice handling.
- 
			_interactive() protectedInteractive
- 
			all() publicBake All the controllers at once. Will only bake controllers for models that exist.
- 
			bake() publicAssembles and writes a Controller file
- 
			bakeActions() publicBake scaffold actions
- 
			bakeTest() publicAssembles and writes a unit test file
- 
			confirmController() publicConfirm a to be baked controller with the user
- 
			doComponents() publicInteract with the user and get a list of additional components
- 
			doHelpers() publicInteract with the user and get a list of additional helpers
- 
			execute() publicExecution method always used for tasks
- 
			getName() publicForces the user to specify the controller he wants to bake, and returns the selected controller name.
- 
			getOptionParser() publicGets the option parser instance and configures it.
- 
			initialize() publicOverride initialize
- 
			listAll() publicOutputs 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
- The name of the controller.
- string $useDynamicScaffold
- Whether or not to use dynamic scaffolds.
- array $helpers
- The list of helpers to include.
- array $components
- The list of components to include.
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.
getName() public ¶
getName( string $useDbConfig = null )
Forces the user to specify the controller he wants to bake, and returns the selected controller name.
Parameters
- string $useDbConfig optional null
- Connection name to get a controller name for.
Returns
Controller name
