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.9 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.9
      • 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
  • None

Classes

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

Class ViewTask

Task class for creating and updating view files.

AppShell
Extended by BakeTask
Extended by ViewTask
Package: Cake\Console\Command\Task
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/Console/Command/Task/ViewTask.php

Properties summary

  • $controllerName public
    string
    Name of the controller being used
  • $noTemplateActions public
    array

    An array of action names that don't require templates. These actions will not emit errors when doing bakeActions()

  • $path public
    array
    path to View directory
  • $scaffoldActions public
    array
    Actions to use for scaffolding
  • $tasks public
    array
    Tasks to be loaded by this Task
  • $template public
    string
    The template file to use

Inherited Properties

  • connection, interactive, plugin

Method Summary

  • _associations() protected
    Returns associations for controllers models.
  • _interactive() protected
    Handles interactive baking
  • _loadController() protected

    Loads Controller and sets variables for the template Available template variables 'modelClass', 'primaryKey', 'displayField', 'singularVar', 'pluralVar', 'singularHumanName', 'pluralHumanName', 'fields', 'foreignKeys', 'belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany'

  • _methodsToBake() protected
    Get a list of actions that can / should have views baked for them.
  • all() public
    Bake All views for All controllers.
  • bake() public
    Assembles and writes bakes the view file.
  • bakeActions() public
    Bake a view file for each of the supplied actions
  • customAction() public
    handle creation of baking a custom action view file
  • execute() public
    Execution method always used for tasks
  • getContent() public
    Builds content from template and variables
  • getOptionParser() public
    Gets the option parser instance and configures it.
  • getTemplate() public
    Gets the template name based on the action name
  • initialize() public
    Override initialize

Method Detail

_associations() protected ¶

_associations( Model $model )

Returns associations for controllers models.

Parameters
Model $model
The Model instance.
Returns
array
associations

_interactive() protected ¶

_interactive( )

Handles interactive baking

_loadController() protected ¶

_loadController( )

Loads Controller and sets variables for the template Available template variables 'modelClass', 'primaryKey', 'displayField', 'singularVar', 'pluralVar', 'singularHumanName', 'pluralHumanName', 'fields', 'foreignKeys', 'belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany'

Returns
array
Returns a variables to be made available to a view template

_methodsToBake() protected ¶

_methodsToBake( )

Get a list of actions that can / should have views baked for them.

Returns
array
Array of action names that should be baked

all() public ¶

all( )

Bake All views for All controllers.

bake() public ¶

bake( string $action , string $content = '' )

Assembles and writes bakes the view file.

Parameters
string $action
Action to bake
string $content optional ''
Content to write
Returns
boolean
Success

bakeActions() public ¶

bakeActions( array $actions , array $vars )

Bake a view file for each of the supplied actions

Parameters
array $actions
Array of actions to make files for.
array $vars
The template variables.

customAction() public ¶

customAction( )

handle creation of baking a custom action view file

execute() public ¶

execute( )

Execution method always used for tasks

Returns
mixed
Overrides
BakeTask::execute()

getContent() public ¶

getContent( string $action , array $vars = null )

Builds content from template and variables

Parameters
string $action
name to generate content to
array $vars optional null
passed for use in templates
Returns
string
content from template

getOptionParser() public ¶

getOptionParser( )

Gets the option parser instance and configures it.

Returns
ConsoleOptionParser

getTemplate() public ¶

getTemplate( string $action )

Gets the template name based on the action name

Parameters
string $action
name
Returns
string
template name

initialize() public ¶

initialize( )

Override initialize

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

$controllerName ¶

public string

Name of the controller being used

null

$noTemplateActions ¶

public array

An array of action names that don't require templates. These actions will not emit errors when doing bakeActions()

array('delete')

$path ¶

public array

path to View directory

null

$scaffoldActions ¶

public array

Actions to use for scaffolding

array('index', 'view', 'add', 'edit')

$tasks ¶

public array

Tasks to be loaded by this Task

array('Project', 'Controller', 'DbConfig', 'Template')

$template ¶

public string

The template file to use

null
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