Class Scaffold
Scaffolding is a set of automatic actions for starting web development work faster.
Scaffold inspects your database tables, and making educated guesses, sets up a number of pages for each of your Models. These pages have data forms that work, and afford the web developer an early look at the data, and the possibility to over-ride scaffolded actions with custom-made ones.
Deprecated: 3.0.0 Dynamic scaffolding will be removed and replaced in 3.0
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/Controller/Scaffold.php
Properties summary
-
$_passedVars
protectedarray
List of variables to collect from the associated controller -
$_validSession
protectedboolean
Valid session. -
$controller
publicController object -
$layout
publicstring
Name of layout to use with this View. -
$model
publicstring
Name of current model this view context is attached to -
$name
publicstring
Name of the controller to scaffold -
$request
publicRequest object -
$scaffoldTitle
publicstring
Title HTML element for current scaffolded view -
$viewPath
publicstring
Path to View.
Method Summary
-
__construct() public deprecated
Construct and set up given controller with given parameters. -
_associations() protected deprecated
Returns associations for controllers models. -
_scaffold() protected deprecated
When methods are now present in a controller scaffoldView is used to call default Scaffold methods if:
public $scaffold;
is placed in the controller's class definition. -
_scaffoldDelete() protected deprecated
Performs a delete on given scaffolded Model. -
_scaffoldError() protected deprecated
Show a scaffold error -
_scaffoldForm() protected deprecated
Renders an add or edit action for scaffolded model. -
_scaffoldIndex() protected deprecated
Renders index action of scaffolded model. -
_scaffoldSave() protected deprecated
Saves or updates the scaffolded model. -
_scaffoldView() protected deprecated
Renders a view action of scaffolded model. -
_sendMessage() protected deprecated
Sends a message to the user. Either uses Sessions or flash messages depending on the availability of a session
Method Detail
__construct() public deprecated ¶
__construct( Controller
$controller , CakeRequest
$request )
Construct and set up given controller with given parameters.
Parameters
-
Controller
$controller - Controller to scaffold
-
CakeRequest
$request - Request parameters.
Throws
_associations() protected deprecated ¶
_associations( )
Returns associations for controllers models.
Returns
Associations for model
_scaffold() protected deprecated ¶
_scaffold( CakeRequest
$request )
When methods are now present in a controller
scaffoldView is used to call default Scaffold methods if:
public $scaffold;
is placed in the controller's class definition.
Parameters
-
CakeRequest
$request - Request object for scaffolding
Throws
MissingActionException
When methods are not scaffolded.
MissingDatabaseException
When the database connection is undefined.
_scaffoldDelete() protected deprecated ¶
_scaffoldDelete( CakeRequest
$request )
Performs a delete on given scaffolded Model.
Parameters
-
CakeRequest
$request - Request for scaffolding
Returns
Success on delete, error if delete fails
Throws
MethodNotAllowedException
When HTTP method is not a DELETE
NotFoundException
When id being deleted does not exist.
_scaffoldError() protected deprecated ¶
_scaffoldError( )
Show a scaffold error
Returns
A rendered view showing the error
_scaffoldForm() protected deprecated ¶
_scaffoldForm( string $action = 'edit' )
Renders an add or edit action for scaffolded model.
Parameters
- string $action optional 'edit'
- Action (add or edit)
_scaffoldIndex() protected deprecated ¶
_scaffoldIndex( array $params )
Renders index action of scaffolded model.
Parameters
- array $params
- Parameters for scaffolding
Returns
A rendered view listing rows from Models database table
_scaffoldSave() protected deprecated ¶
_scaffoldSave( CakeRequest
$request , string $action = 'edit' )
Saves or updates the scaffolded model.
Parameters
-
CakeRequest
$request - Request Object for scaffolding
- string $action optional 'edit'
- add or edit
Returns
Success on save/update, add/edit form if data is empty or error if save or update fails
Throws
_scaffoldView() protected deprecated ¶
_scaffoldView( CakeRequest
$request )
Renders a view action of scaffolded model.
Parameters
-
CakeRequest
$request - Request Object for scaffolding
Returns
A rendered view of a row from Models database table
Throws
_sendMessage() protected deprecated ¶
_sendMessage( string $message , string $element = 'default' )
Sends a message to the user. Either uses Sessions or flash messages depending on the availability of a session
Parameters
- string $message
- Message to display
- string $element optional 'default'
- Flash template to use
Properties detail
$_passedVars ¶
List of variables to collect from the associated controller
array( 'layout', 'name', 'viewPath', 'request' )