a grand renaming so that the most significant portion of the name comes first
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Controller bake template file
|
||||
*
|
||||
* Allows templating of Controllers generated from bake.
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.
|
||||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
echo "<?php\n";
|
||||
?>
|
||||
class <?php echo $controllerName; ?>Controller extends <?php echo $plugin; ?>AppController {
|
||||
|
||||
var $name = '<?php echo $controllerName; ?>';
|
||||
<?php if ($isScaffold): ?>
|
||||
var $scaffold;
|
||||
<?php else: ?>
|
||||
<?php
|
||||
if (count($helpers)):
|
||||
echo "\tvar \$helpers = array(";
|
||||
for ($i = 0, $len = count($helpers); $i < $len; $i++):
|
||||
if ($i != $len - 1):
|
||||
echo "'" . Inflector::camelize($helpers[$i]) . "', ";
|
||||
else:
|
||||
echo "'" . Inflector::camelize($helpers[$i]) . "'";
|
||||
endif;
|
||||
endfor;
|
||||
echo ");\n";
|
||||
endif;
|
||||
|
||||
if (count($components)):
|
||||
echo "\tvar \$components = array(";
|
||||
for ($i = 0, $len = count($components); $i < $len; $i++):
|
||||
if ($i != $len - 1):
|
||||
echo "'" . Inflector::camelize($components[$i]) . "', ";
|
||||
else:
|
||||
echo "'" . Inflector::camelize($components[$i]) . "'";
|
||||
endif;
|
||||
endfor;
|
||||
echo ");\n";
|
||||
endif;
|
||||
|
||||
echo $actions;
|
||||
|
||||
endif; ?>
|
||||
|
||||
}
|
||||
<?php echo "?>"; ?>
|
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Fixture Template file
|
||||
*
|
||||
* Fixture Template used when baking fixtures with bake
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.
|
||||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
?>
|
||||
<?php echo '<?php' . "\n"; ?>
|
||||
/* <?php echo $model; ?> Fixture generated on: <?php echo date('Y-m-d H:m:s') . " : ". time(); ?> */
|
||||
class <?php echo $model; ?>Fixture extends CakeTestFixture {
|
||||
var $name = '<?php echo $model; ?>';
|
||||
<?php if ($table): ?>
|
||||
var $table = '<?php echo $table; ?>';
|
||||
<?php endif; ?>
|
||||
<?php if ($import): ?>
|
||||
var $import = <?php echo $import; ?>;
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($schema): ?>
|
||||
var $fields = <?php echo $schema; ?>;
|
||||
<?php endif;?>
|
||||
|
||||
<?php if ($records): ?>
|
||||
var $records = <?php echo $records; ?>;
|
||||
<?php endif;?>
|
||||
}
|
||||
<?php echo '?>'; ?>
|
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
/**
|
||||
* Model template file.
|
||||
*
|
||||
* Used by bake to create new Model files.
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.console.libs.templates.objects
|
||||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
echo "<?php\n"; ?>
|
||||
class <?php echo $name ?> extends <?php echo $plugin; ?>AppModel {
|
||||
var $name = '<?php echo $name; ?>';
|
||||
<?php if ($useDbConfig != 'default'): ?>
|
||||
var $useDbConfig = '<?php echo $useDbConfig; ?>';
|
||||
<?php endif;?>
|
||||
<?php if ($useTable && $useTable !== Inflector::tableize($name)):
|
||||
$table = "'$useTable'";
|
||||
echo "\tvar \$useTable = $table;\n";
|
||||
endif;
|
||||
if ($primaryKey !== 'id'): ?>
|
||||
var $primaryKey = '<?php echo $primaryKey; ?>';
|
||||
<?php endif;
|
||||
if ($displayField): ?>
|
||||
var $displayField = '<?php echo $displayField; ?>';
|
||||
<?php endif;
|
||||
|
||||
if (!empty($validate)):
|
||||
echo "\tvar \$validate = array(\n";
|
||||
foreach ($validate as $field => $validations):
|
||||
echo "\t\t'$field' => array(\n";
|
||||
foreach ($validations as $key => $validator):
|
||||
echo "\t\t\t'$key' => array(\n";
|
||||
echo "\t\t\t\t'rule' => array('$validator'),\n";
|
||||
echo "\t\t\t\t//'message' => 'Your custom message here',\n";
|
||||
echo "\t\t\t\t//'allowEmpty' => false,\n";
|
||||
echo "\t\t\t\t//'required' => false,\n";
|
||||
echo "\t\t\t\t//'last' => false, // Stop validation after this rule\n";
|
||||
echo "\t\t\t\t//'on' => 'create', // Limit validation to 'create' or 'update' operations\n";
|
||||
echo "\t\t\t),\n";
|
||||
endforeach;
|
||||
echo "\t\t),\n";
|
||||
endforeach;
|
||||
echo "\t);\n";
|
||||
endif;
|
||||
|
||||
foreach ($associations as $assoc):
|
||||
if (!empty($assoc)):
|
||||
?>
|
||||
//The Associations below have been created with all possible keys, those that are not needed can be removed
|
||||
<?php
|
||||
break;
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
foreach (array('hasOne', 'belongsTo') as $assocType):
|
||||
if (!empty($associations[$assocType])):
|
||||
$typeCount = count($associations[$assocType]);
|
||||
echo "\n\tvar \$$assocType = array(";
|
||||
foreach ($associations[$assocType] as $i => $relation):
|
||||
$out = "\n\t\t'{$relation['alias']}' => array(\n";
|
||||
$out .= "\t\t\t'className' => '{$relation['className']}',\n";
|
||||
$out .= "\t\t\t'foreignKey' => '{$relation['foreignKey']}',\n";
|
||||
$out .= "\t\t\t'conditions' => '',\n";
|
||||
$out .= "\t\t\t'fields' => '',\n";
|
||||
$out .= "\t\t\t'order' => ''\n";
|
||||
$out .= "\t\t)";
|
||||
if ($i + 1 < $typeCount) {
|
||||
$out .= ",";
|
||||
}
|
||||
echo $out;
|
||||
endforeach;
|
||||
echo "\n\t);\n";
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
if (!empty($associations['hasMany'])):
|
||||
$belongsToCount = count($associations['hasMany']);
|
||||
echo "\n\tvar \$hasMany = array(";
|
||||
foreach ($associations['hasMany'] as $i => $relation):
|
||||
$out = "\n\t\t'{$relation['alias']}' => array(\n";
|
||||
$out .= "\t\t\t'className' => '{$relation['className']}',\n";
|
||||
$out .= "\t\t\t'foreignKey' => '{$relation['foreignKey']}',\n";
|
||||
$out .= "\t\t\t'dependent' => false,\n";
|
||||
$out .= "\t\t\t'conditions' => '',\n";
|
||||
$out .= "\t\t\t'fields' => '',\n";
|
||||
$out .= "\t\t\t'order' => '',\n";
|
||||
$out .= "\t\t\t'limit' => '',\n";
|
||||
$out .= "\t\t\t'offset' => '',\n";
|
||||
$out .= "\t\t\t'exclusive' => '',\n";
|
||||
$out .= "\t\t\t'finderQuery' => '',\n";
|
||||
$out .= "\t\t\t'counterQuery' => ''\n";
|
||||
$out .= "\t\t)";
|
||||
if ($i + 1 < $belongsToCount) {
|
||||
$out .= ",";
|
||||
}
|
||||
echo $out;
|
||||
endforeach;
|
||||
echo "\n\t);\n\n";
|
||||
endif;
|
||||
|
||||
if (!empty($associations['hasAndBelongsToMany'])):
|
||||
$habtmCount = count($associations['hasAndBelongsToMany']);
|
||||
echo "\n\tvar \$hasAndBelongsToMany = array(";
|
||||
foreach ($associations['hasAndBelongsToMany'] as $i => $relation):
|
||||
$out = "\n\t\t'{$relation['alias']}' => array(\n";
|
||||
$out .= "\t\t\t'className' => '{$relation['className']}',\n";
|
||||
$out .= "\t\t\t'joinTable' => '{$relation['joinTable']}',\n";
|
||||
$out .= "\t\t\t'foreignKey' => '{$relation['foreignKey']}',\n";
|
||||
$out .= "\t\t\t'associationForeignKey' => '{$relation['associationForeignKey']}',\n";
|
||||
$out .= "\t\t\t'unique' => true,\n";
|
||||
$out .= "\t\t\t'conditions' => '',\n";
|
||||
$out .= "\t\t\t'fields' => '',\n";
|
||||
$out .= "\t\t\t'order' => '',\n";
|
||||
$out .= "\t\t\t'limit' => '',\n";
|
||||
$out .= "\t\t\t'offset' => '',\n";
|
||||
$out .= "\t\t\t'finderQuery' => '',\n";
|
||||
$out .= "\t\t\t'deleteQuery' => '',\n";
|
||||
$out .= "\t\t\t'insertQuery' => ''\n";
|
||||
$out .= "\t\t)";
|
||||
if ($i + 1 < $habtmCount) {
|
||||
$out .= ",";
|
||||
}
|
||||
echo $out;
|
||||
endforeach;
|
||||
echo "\n\t);\n\n";
|
||||
endif;
|
||||
?>
|
||||
}
|
||||
<?php echo '?>'; ?>
|
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Test Case bake template
|
||||
*
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.console.libs.templates.objects
|
||||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
echo "<?php\n";
|
||||
echo "/* ". $className ." Test cases generated on: " . date('Y-m-d H:m:s') . " : ". time() . "*/\n";
|
||||
?>
|
||||
App::import('<?php echo $type; ?>', '<?php echo $plugin . $className;?>');
|
||||
|
||||
<?php if ($mock and strtolower($type) == 'controller'): ?>
|
||||
class Test<?php echo $fullClassName; ?> extends <?php echo $fullClassName; ?> {
|
||||
var $autoRender = false;
|
||||
|
||||
function redirect($url, $status = null, $exit = true) {
|
||||
$this->redirectUrl = $url;
|
||||
}
|
||||
}
|
||||
|
||||
<?php endif; ?>
|
||||
class <?php echo $fullClassName; ?>TestCase extends CakeTestCase {
|
||||
<?php if (!empty($fixtures)): ?>
|
||||
var $fixtures = array('<?php echo join("', '", $fixtures); ?>');
|
||||
|
||||
<?php endif; ?>
|
||||
function startTest() {
|
||||
$this-><?php echo $className . ' =& ' . $construction; ?>
|
||||
}
|
||||
|
||||
function endTest() {
|
||||
unset($this-><?php echo $className;?>);
|
||||
ClassRegistry::flush();
|
||||
}
|
||||
|
||||
<?php foreach ($methods as $method): ?>
|
||||
function test<?php echo Inflector::classify($method); ?>() {
|
||||
|
||||
}
|
||||
|
||||
<?php endforeach;?>
|
||||
}
|
||||
<?php echo '?>'; ?>
|
Reference in New Issue
Block a user