CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (GitHub)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • Slack
    • Paid Support
CakePHP

C CakePHP 2.2 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.2
      • 4.2
      • 4.1
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Packages

  • Cake
    • Cache
      • Engine
    • Configure
    • Console
      • Command
        • Task
    • Controller
      • Component
        • Acl
        • Auth
    • Core
    • Error
    • Event
    • I18n
    • Log
      • Engine
    • Model
      • Behavior
      • Datasource
        • Database
        • Session
      • Validator
    • Network
      • Email
      • Http
    • Routing
      • Filter
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper

Classes

  • BakeTask
  • ControllerTask
  • DbConfigTask
  • ExtractTask
  • FixtureTask
  • ModelTask
  • PluginTask
  • ProjectTask
  • TemplateTask
  • TestTask
  • ViewTask

Class ControllerTask

Task class for creating and updating controller files.

AppShell
Extended by BakeTask
Extended by ControllerTask
Package: Cake\Console\Command\Task
Copyright: Copyright 2005-2012, 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

  • $path public
    array
    path to Controller directory
  • $tasks public
    array
    Tasks to be loaded by this Task

Inherited Properties

  • connection, interactive, plugin

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.
  • 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
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
Array of values for property.

_interactive() protected ¶

_interactive( )

Interactive

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
string
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
string
Baked actions

bakeTest() public ¶

bakeTest( string $className )

Assembles and writes a unit test file

Parameters
string $className
Controller class name
Returns
string
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
array
Components the user wants to use.

doHelpers() public ¶

doHelpers( )

Interact with the user and get a list of additional helpers

Returns
array
Helpers that the user wants to use.

execute() public ¶

execute( )

Execution method always used for tasks

Overrides
BakeTask::execute()

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
string
Controller name

getOptionParser() public ¶

getOptionParser( )

get the option parser.

initialize() public ¶

initialize( )

Override initialize

listAll() public ¶

listAll( string $useDbConfig = null )

Outputs and gets the list of possible controllers from database

Parameters
string $useDbConfig optional null
Database configuration name
Returns
array
Set of controllers

Methods inherited from BakeTask

getPath() public ¶

getPath( )

Gets the path for output. Checks the plugin property and returns the correct path.

Returns
string
Path to output.

startup() public ¶

startup( )

Disable caching and enable debug for baking. This forces the most current database schema to be used.

Properties detail

$path ¶

public array

path to Controller directory

null

$tasks ¶

public array

Tasks to be loaded by this Task

array('Model', 'Test', 'Template', 'DbConfig', 'Project')
OpenHub
Rackspace
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (GitHub)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • Slack
  • Paid Support

Generated using CakePHP API Docs