Bake Class Reference

List of all members.


Public Member Functions

 Bake ()
 bakeController ($controllerName, $uses, $helpers, $components, $actions= '', $wannaUseScaffold= 'y')
 bakeDbConfig ($driver, $connect, $host, $login, $password, $database, $prefix)
 bakeModel ($name, $useDbConfig= 'default', $useTable=null, $primaryKey= 'id', $validate=array(), $associations=array())
 bakeUnitTest ($type, $className)
 bakeView ($controllerName, $actionName, $content= '')
 divTag ($class, $text)
 doController ()
 doDbConfig ()
 doModel ()
 doUnitTest ()
 doView ()
 generateAreaDiv ($tagName, $prompt, $required=false, $errorMsg=null, $cols=60, $rows=10, $htmlOptions=null)
 generateCheckboxDiv ($tagName, $prompt, $required=false, $errorMsg=null, $htmlOptions=null)
 generateDate ($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null, $selected=null)
 generateDateTime ($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null, $selected=null)
 generateFields ($fields, $readOnly=false)
 generateInputDiv ($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null)
 generateSelectDiv ($tagName, $prompt, $options, $selected=null, $selectAttr=null, $optionAttr=null, $required=false, $errorMsg=null)
 generateSubmitDiv ($displayText, $htmlOptions=null)
 generateTime ($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null, $selected=null)
 getInput ($prompt, $options=null, $default=null)
 help ()
 hr ()
 main ()
 project ($projectPath=null)
 stderr ($string)
 stdout ($string, $newline=true)
 welcome ()

Public Attributes

 $controllerName = null
 $interactive = false
 $stderr
 $stdin
 $stdout

Detailed Description

Definition at line 151 of file bake.php.


Member Function Documentation

Bake::Bake (  ) 

Constructor.

Returns:
Bake

Definition at line 200 of file bake.php.

Bake::bakeController ( controllerName,
uses,
helpers,
components,
actions = '',
wannaUseScaffold = 'y' 
)

Assembles and writes a Controller file.

Parameters:
string $controllerName
array $uses
array $helpers
array $components
string $actions

Definition at line 1677 of file bake.php.

References $filename, $help, and Inflector::camelize().

Bake::bakeDbConfig ( driver,
connect,
host,
login,
password,
database,
prefix 
)

Creates a database configuration file for Bake.

Parameters:
string $host
string $login
string $password
string $database

Definition at line 1514 of file bake.php.

References $filename.

Referenced by doDbConfig().

Bake::bakeModel ( name,
useDbConfig = 'default',
useTable = null,
primaryKey = 'id',
validate = array(),
associations = array() 
)

Assembles and writes a Model file.

Parameters:
string $name
object $useDbConfig
string $useTable
string $primaryKey
array $validate
array $associations

Definition at line 1541 of file bake.php.

References $filename.

Referenced by doModel().

Bake::bakeUnitTest ( type,
className 
)

Assembles and writes a unit test file.

Parameters:
string $type One of "model", and "controller".
string $className

Definition at line 1735 of file bake.php.

References $filename.

Referenced by doModel().

Bake::bakeView ( controllerName,
actionName,
content = '' 
)

Assembles and writes a View file.

Parameters:
string $controllerName
string $actionName
string $content

Definition at line 1659 of file bake.php.

References $filename, and Inflector::underscore().

Referenced by doView().

Bake::divTag ( class,
text 
)

Returns the text wrapped in an HTML DIV, followed by a newline.

Parameters:
string $class
string $text
Returns:
Generated HTML.

Definition at line 2232 of file bake.php.

Bake::doController (  ) 

Action to create a Controller.

Definition at line 1128 of file bake.php.

References $help, Inflector::camelize(), and Inflector::underscore().

Referenced by main().

Bake::doDbConfig (  ) 

Database configuration setup.

Definition at line 252 of file bake.php.

References bakeDbConfig(), Configuration, getInput(), hr(), and stdout().

Referenced by main().

Bake::doModel (  ) 

Action to create a Model.

Definition at line 363 of file bake.php.

References bakeModel(), bakeUnitTest(), doUnitTest(), ConnectionManager::getDataSource(), getInput(), hr(), stdout(), and Inflector::tableize().

Referenced by main().

Bake::doUnitTest (  ) 

Action to create a Unit Test.

Returns:
Success

Definition at line 1494 of file bake.php.

Referenced by doModel().

Bake::doView (  ) 

Action to create a View.

Definition at line 766 of file bake.php.

References $controllerName, $file, $shortPath, bakeView(), Inflector::camelize(), getInput(), hr(), stdout(), and Inflector::underscore().

Referenced by main().

Bake::generateAreaDiv ( tagName,
prompt,
required = false,
errorMsg = null,
cols = 60,
rows = 10,
htmlOptions = null 
)

Generates PHP code for a View file that makes a textarea.

Parameters:
string $tagName
string $prompt
boolean $required
string $errorMsg
integer $cols
integer $rows
array $htmlOptions
Returns:
Generated HTML and PHP.

Definition at line 2029 of file bake.php.

Bake::generateCheckboxDiv ( tagName,
prompt,
required = false,
errorMsg = null,
htmlOptions = null 
)

Generates PHP code for a View file that makes a checkbox, wrapped in a DIV.

Parameters:
string $tagName
string $prompt
boolean $required
string $errorMsg
array $htmlOptions
Returns:
Generated HTML and PHP.

Definition at line 2055 of file bake.php.

Bake::generateDate ( tagName,
prompt,
required = false,
errorMsg = null,
size = 20,
htmlOptions = null,
selected = null 
)

Generates PHP code for a View file that makes a date-picker, wrapped in a DIV.

Parameters:
string $tagName
string $prompt
boolean $required
string $errorMsg
integer $size
array $htmlOptions
string $selected
Returns:
Generated HTML and PHP.

Definition at line 2081 of file bake.php.

Bake::generateDateTime ( tagName,
prompt,
required = false,
errorMsg = null,
size = 20,
htmlOptions = null,
selected = null 
)

EGenerates PHP code for a View file that makes a datetime-picker, wrapped in a DIV.

Parameters:
string $tagName
string $prompt
boolean $required
string $errorMsg
integer $size
array $htmlOptions
string $selected
Returns:
Generated HTML and PHP.

Definition at line 2129 of file bake.php.

Bake::generateFields ( fields,
readOnly = false 
)

Takes an array of database fields, and generates an HTML form for a View. This is an extraction from the Scaffold functionality.

Parameters:
array $fields
boolean $readOnly
Returns:
Generated HTML and PHP.

Definition at line 1909 of file bake.php.

References ClassRegistry::getObject(), and Inflector::underscore().

Bake::generateInputDiv ( tagName,
prompt,
required = false,
errorMsg = null,
size = 20,
htmlOptions = null 
)

Generates PHP code for a View file that makes an INPUT field, wrapped in a DIV.

Parameters:
string $tagName
string $prompt
boolean $required
string $errorMsg
integer $size
array $htmlOptions
Returns:
Generated HTML and PHP.

Definition at line 2153 of file bake.php.

Bake::generateSelectDiv ( tagName,
prompt,
options,
selected = null,
selectAttr = null,
optionAttr = null,
required = false,
errorMsg = null 
)

Generates PHP code for a View file that makes a SELECT box, wrapped in a DIV.

Parameters:
string $tagName
string $prompt
array $options
string $selected
array $selectAttr
array $optionAttr
boolean $required
string $errorMsg
Returns:
Generated HTML and PHP.

Definition at line 2182 of file bake.php.

Bake::generateSubmitDiv ( displayText,
htmlOptions = null 
)

Generates PHP code for a View file that makes a submit button, wrapped in a DIV.

Parameters:
string $displayText
array $htmlOptions
Returns:
Generated HTML.

Definition at line 2220 of file bake.php.

Bake::generateTime ( tagName,
prompt,
required = false,
errorMsg = null,
size = 20,
htmlOptions = null,
selected = null 
)

Generates PHP code for a View file that makes a time-picker, wrapped in a DIV.

Parameters:
string $tagName
string $prompt
boolean $required
string $errorMsg
integer $size
array $htmlOptions
string $selected
Returns:
Generated HTML and PHP.

Definition at line 2106 of file bake.php.

Bake::getInput ( prompt,
options = null,
default = null 
)

Prompts the user for input, and returns it.

Parameters:
string $prompt Prompt text.
mixed $options Array or string of options.
string $default Default input value.
Returns:
Either the default value, or the user-provided input.

Definition at line 1810 of file bake.php.

Referenced by doDbConfig(), doModel(), doView(), and main().

Bake::help (  ) 

Outputs usage text on the standard output.

Definition at line 2268 of file bake.php.

Bake::hr (  ) 

Outputs a series of minus characters to the standard output, acts as a visual separator.

Definition at line 1862 of file bake.php.

Referenced by doDbConfig(), doModel(), doView(), and main().

Bake::main (  ) 

Main-loop method.

Definition at line 207 of file bake.php.

References doController(), doDbConfig(), doModel(), doView(), getInput(), hr(), and stdout().

Bake::project ( projectPath = null  ) 

Checks that given project path does not already exist, and finds the app directory in it. Then it calls __buildDirLayout() with that information.

Parameters:
string $projectPath

Definition at line 2293 of file bake.php.

Bake::stderr ( string  ) 

Outputs to the stderr filehandle.

Parameters:
string $string Error text to output.

Definition at line 1855 of file bake.php.

Bake::stdout ( string,
newline = true 
)

Outputs to the stdout filehandle.

Parameters:
string $string String to output.
boolean $newline If true, the outputs gets an added newline.

Definition at line 1843 of file bake.php.

Referenced by doDbConfig(), doModel(), doView(), and main().

Bake::welcome (  ) 

Outputs an ASCII art banner to standard output.

Definition at line 2496 of file bake.php.


Member Data Documentation

Bake::$controllerName = null

Definition at line 176 of file bake.php.

Referenced by doView().

Bake::$interactive = false

Definition at line 182 of file bake.php.

Bake::$stderr

Definition at line 170 of file bake.php.

Bake::$stdin

Definition at line 158 of file bake.php.

Bake::$stdout

Definition at line 164 of file bake.php.


The documentation for this class was generated from the following file: