removing usage of Model::loadInfo() replaced by Model::schema(), removing new lines at the end of some files, removed deprecated chmodr() function from basics, updated bake and scaffold views

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5912 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-10-28 04:18:18 +00:00
parent 00c7daf8bd
commit fbd3811cd1
37 changed files with 461 additions and 518 deletions

View file

@ -1227,7 +1227,7 @@
* @return mixed plural form of translated string if $return is false string will be echoed
*/
function __n($singular, $plural, $count, $return = false) {
if(!$singular) {
if (!$singular) {
return;
}
if (!class_exists('I18n')) {
@ -1497,41 +1497,6 @@
$string = str_replace('/', '_', $string);
return $string;
}
/**
* See Folder::chmod
*
* @deprecated
*/
function chmodr($path, $mode = 0755) {
trigger_error("Deprecated. See Folder::chmod()", E_USER_ERROR);
if (!is_dir($path)) {
return chmod($path, $mode);
}
$dir = opendir($path);
while ($file = readdir($dir)) {
if ($file != '.' && $file != '..') {
$fullpath = $path . '/' . $file;
if (!is_dir($fullpath)) {
if (!chmod($fullpath, $mode)) {
return false;
}
} else {
if (!chmodr($fullpath, $mode)) {
return false;
}
}
}
}
closedir($dir);
if (chmod($path, $mode)) {
return true;
} else {
return false;
}
}
/**
* Implements http_build_query for PHP4.
*
@ -1590,4 +1555,4 @@
}
return $val2;
}
?>
?>

View file

@ -284,7 +284,7 @@ class AclShell extends Shell {
}
$nodes = $this->Acl->{$class}->findAll($conditions, null, 'lft ASC');
if (empty($nodes)) {
if(isset($this->args[1])) {
if (isset($this->args[1])) {
$this->error(sprintf(__("%s not found", true), $this->args[1]), __("No tree returned.", true));
} elseif (isset($this->args[0])) {
$this->error(sprintf(__("%s not found", true), $this->args[0]), __("No tree returned.", true));
@ -490,4 +490,4 @@ class AclShell extends Shell {
return $vars;
}
}
?>
?>

View file

@ -338,7 +338,7 @@ class Shell extends Object {
* @access public
*/
function out($string, $newline = true) {
if(is_array($string)) {
if (is_array($string)) {
$str = '';
foreach($string as $message) {
$str .= $message ."\n";
@ -354,7 +354,7 @@ class Shell extends Object {
* @access public
*/
function err($string) {
if(is_array($string)) {
if (is_array($string)) {
$str = '';
foreach($string as $message) {
$str .= $message ."\n";
@ -607,4 +607,4 @@ class Shell extends Object {
return Inflector::humanize(Inflector::underscore(Inflector::pluralize($name)));
}
}
?>
?>

View file

@ -243,7 +243,7 @@ class ViewTask extends Shell {
$pluralVar = Inflector::variable($this->controllerName);
$singularHumanName = Inflector::humanize($modelClass);
$pluralHumanName = Inflector::humanize($this->controllerName);
$fields = $modelObj->_tableInfo->value;
$fields = array_keys($modelObj->schema());
$foreignKeys = $modelObj->keyToTable;
$belongsTo = $modelObj->belongsTo;
$hasOne = $modelObj->hasOne;

View file

@ -27,18 +27,18 @@
<div class="<?php echo $singularVar;?>">
<?php echo "<?php echo \$form->create('{$modelClass}');?>\n";?>
<fieldset>
<legend><?php echo "<?php echo sprintf(__('".Inflector::humanize($action)." %s', true), __('{$singularHumanName}', true));?>";?></legend>
<legend><?php echo "<?php echo __('".Inflector::humanize($action)." {$singularHumanName}', true);?>";?></legend>
<?php
echo "\t<?php\n";
foreach ($fields as $field) {
if ($action == 'add' && $field['name'] == $primaryKey) {
if ($action == 'add' && $field == $primaryKey) {
continue;
} elseif (!in_array($field['name'], array('created', 'modified', 'updated'))) {
echo "\t\techo \$form->input('{$field['name']}');\n";
} elseif (!in_array($field, array('created', 'modified', 'updated'))) {
echo "\t\techo \$form->input('{$field}');\n";
}
}
foreach ($hasAndBelongsToMany as $assocName => $assocData) {
echo "\t\t echo \$form->input('{$assocName}');\n";
echo "\t\techo \$form->input('{$assocName}');\n";
}
echo "\t?>\n";
?>
@ -52,7 +52,7 @@
<?php if ($action != 'add'):?>
<li><?php echo "<?php echo \$html->link(__('Delete', true), array('action'=>'delete', \$form->value('{$modelClass}.{$primaryKey}')), null, sprintf(__('Are you sure you want to delete # %s?', true), \$form->value('{$modelClass}.{$primaryKey}'))); ?>";?></li>
<?php endif;?>
<li><?php echo "<?php echo \$html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action'=>'index'));?>";?></li>
<li><?php echo "<?php echo \$html->link(__('List {$pluralHumanName}', true), array('action'=>'index'));?>";?></li>
<?php
foreach ($foreignKeys as $field => $value) {
$otherModelClass = $value['1'];
@ -63,8 +63,8 @@
$otherSingularName = Inflector::variable($otherModelClass);
$otherPluralHumanName = Inflector::humanize($otherControllerPath);
$otherSingularHumanName = Inflector::humanize($otherModelKey);
echo "\t\t<li><?php echo \$html->link(sprintf(__('List %s', true), __('{$otherPluralHumanName}', true)), array('controller'=> '{$otherControllerPath}', 'action'=>'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(sprintf(__('New %s', true), __('{$otherSingularHumanName}', true)), array('controller'=> '{$otherControllerPath}', 'action'=>'add')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('List {$otherPluralHumanName}', true), array('controller'=> '{$otherControllerPath}', 'action'=>'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(sprintf(__('New {$otherSingularHumanName}', true), array('controller'=> '{$otherControllerPath}', 'action'=>'add')); ?> </li>\n";
}
}
?>

View file

@ -36,7 +36,7 @@ echo \$paginator->counter(array(
<table cellpadding="0" cellspacing="0">
<tr>
<?php foreach ($fields as $field):?>
<th><?php echo "<?php echo \$paginator->sort('{$field['name']}');?>";?></th>
<th><?php echo "<?php echo \$paginator->sort('{$field}');?>";?></th>
<?php endforeach;?>
<th class="actions"><?php echo "<?php __('Actions');?>";?></th>
</tr>
@ -52,13 +52,13 @@ foreach (\${$pluralVar} as \${$singularVar}):
echo "\t<tr<?php echo \$class;?>>\n";
foreach ($fields as $field) {
if (in_array($field['name'], array_keys($foreignKeys))) {
$otherModelClass = $foreignKeys[$field['name']][1];
if (in_array($field, array_keys($foreignKeys))) {
$otherModelClass = $foreignKeys[$field][1];
$otherModelKey = Inflector::underscore($otherModelClass);
$otherControllerName = Inflector::pluralize($otherModelClass);
$otherControllerPath = Inflector::underscore($otherControllerName);
if (isset($foreignKeys[$field['name']][2])) {
$otherModelClass = $foreignKeys[$field['name']][2];
if (isset($foreignKeys[$field][2])) {
$otherModelClass = $foreignKeys[$field][2];
}
$otherVariableName = Inflector::variable($otherModelClass);
$otherModelObj =& ClassRegistry::getObject($otherModelKey);
@ -66,7 +66,7 @@ foreach (\${$pluralVar} as \${$singularVar}):
$otherDisplayField = $otherModelObj->displayField;
echo "\t\t<td>\n\t\t\t<?php echo \$html->link(__(\${$singularVar}['{$otherModelClass}']['{$otherDisplayField}'], true), array('controller'=> '{$otherControllerPath}', 'action'=>'view', \${$singularVar}['{$otherModelClass}']['{$otherPrimaryKey}'])); ?>\n\t\t</td>\n";
} else {
echo "\t\t<td>\n\t\t\t<?php echo \${$singularVar}['{$modelClass}']['{$field['name']}'] ?>\n\t\t</td>\n";
echo "\t\t<td>\n\t\t\t<?php echo \${$singularVar}['{$modelClass}']['{$field}'] ?>\n\t\t</td>\n";
}
}
@ -88,7 +88,7 @@ echo "<?php endforeach; ?>\n";
</div>
<div class="actions">
<ul>
<li><?php echo "<?php echo \$html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action'=>'add')); ?>";?></li>
<li><?php echo "<?php echo \$html->link(__('New {$singularHumanName}', true), array('action'=>'add')); ?>";?></li>
<?php
foreach ($foreignKeys as $field => $value) {
$otherModelClass = $value['1'];
@ -99,8 +99,8 @@ echo "<?php endforeach; ?>\n";
$otherVariableName = Inflector::variable($otherModelClass);
$otherPluralHumanName = Inflector::humanize($otherControllerPath);
$otherSingularHumanName = Inflector::humanize($otherModelKey);
echo "\t\t<li><?php echo \$html->link(sprintf(__('List %s', true), __('{$otherPluralHumanName}', true)), array('controller'=> '{$otherControllerPath}', 'action'=>'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(sprintf(__('New %s', true), __('{$otherSingularHumanName}', true)), array('controller'=> '{$otherControllerPath}', 'action'=>'add')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('List {$otherPluralHumanName}', true), array('controller'=> '{$otherControllerPath}', 'action'=>'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('New {$otherSingularHumanName}', true), array('controller'=> '{$otherControllerPath}', 'action'=>'add')); ?> </li>\n";
}
}
?>

View file

@ -35,13 +35,13 @@ foreach ($fields as $field) {
$class = ' class="altrow"';
}
if (in_array($field['name'], array_keys($foreignKeys))) {
$otherModelClass = $foreignKeys[$field['name']][1];
if (in_array($field, array_keys($foreignKeys))) {
$otherModelClass = $foreignKeys[$field][1];
$otherModelKey = Inflector::underscore($otherModelClass);
$otherControllerName = Inflector::pluralize($otherModelClass);
$otherControllerPath = Inflector::underscore($otherControllerName);
if (isset($foreignKeys[$field['name']][2])) {
$otherModelClass = $foreignKeys[$field['name']][2];
if (isset($foreignKeys[$field][2])) {
$otherModelClass = $foreignKeys[$field][2];
}
$otherSingularVar = Inflector::variable($otherModelClass);
$otherModelObj =& ClassRegistry::getObject($otherModelKey);
@ -50,8 +50,8 @@ foreach ($fields as $field) {
echo "\t\t<dt{$class}><?php __('".Inflector::humanize($otherModelClass)."') ?></dt>\n";
echo "\t\t<dd{$class}>\n\t\t\t<?php echo \$html->link(__(\${$singularVar}['{$otherModelClass}']['{$otherDisplayField}'], true), array('controller'=> '{$otherControllerPath}', 'action'=>'view', \${$singularVar}['{$otherModelClass}']['{$otherPrimaryKey}'])); ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
} else {
echo "\t\t<dt{$class}><?php __('".Inflector::humanize($field['name'])."') ?></dt>\n";
echo "\t\t<dd{$class}>\n\t\t\t<?php echo \${$singularVar}['{$modelClass}']['{$field['name']}'] ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
echo "\t\t<dt{$class}><?php __('".Inflector::humanize($field)."') ?></dt>\n";
echo "\t\t<dd{$class}>\n\t\t\t<?php echo \${$singularVar}['{$modelClass}']['{$field}'] ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
}
}
?>
@ -60,10 +60,10 @@ foreach ($fields as $field) {
<div class="actions">
<ul>
<?php
echo "\t\t<li><?php echo \$html->link(sprintf(__('Edit %s', true), __('{$singularHumanName}', true)), array('action'=>'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(sprintf(__('Delete %s', true), __('{$singularHumanName}', true)), array('action'=>'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action'=>'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action'=>'add')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('Edit {$singularHumanName}', true), array('action'=>'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('Delete {$singularHumanName}', true), array('action'=>'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('List {$pluralHumanName}', true), array('action'=>'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('New {$singularHumanName}', true), array('action'=>'add')); ?> </li>\n";
foreach ($foreignKeys as $field => $value) {
$otherModelClass = $value['1'];
@ -91,11 +91,11 @@ foreach ($hasOne as $assocName => $assocData):
$otherPluralHumanName = Inflector::humanize(Inflector::pluralize($assocKey));
$otherSingularHumanName = Inflector::humanize($assocKey);
$otherModelObj =& ClassRegistry::getObject($otherModelKey);
$otherFields = $otherModelObj->_tableInfo->value;
$otherFields = array_keys($otherModelObj->schema());
$otherPrimaryKey = $otherModelObj->primaryKey;
?>
<div class="related">
<h3><?php echo "<?php echo sprintf(__('Related %s', true), __('{$otherSingularHumanName}', true));?>";?></h3>
<h3><?php echo "<?php echo __('Related {$otherSingularHumanName}', true);?>";?></h3>
<?php echo "<?php if (!empty(\${$singularVar}['{$assocName}'])):?>\n";?>
<dl>
<?php
@ -106,15 +106,15 @@ foreach ($hasOne as $assocName => $assocData):
$class = ' class="altrow"';
}
echo "\t\t<dt{$class}>".Inflector::humanize($field['name'])."</dt>\n";
echo "\t\t<dd{$class}>\n\t<?php echo \${$singularVar}['{$assocName}']['{$field['name']}'] ?>\n&nbsp;</dd>\n";
echo "\t\t<dt{$class}>".Inflector::humanize($field)."</dt>\n";
echo "\t\t<dd{$class}>\n\t<?php echo \${$singularVar}['{$assocName}']['{$field}'] ?>\n&nbsp;</dd>\n";
}
?>
</dl>
<?php echo "<?php endif; ?>\n";?>
<div class="actions">
<ul>
<li><?php echo "<?php echo \$html->link(sprintf(__('Edit %s', true), __('{$otherSingularHumanName}', true)), array('controller'=> '{$otherControllerPath}', 'action'=>'edit', \${$singularVar}['{$assocName}']['{$otherPrimaryKey}']));?></li>\n";?>
<li><?php echo "<?php echo \$html->link(__('Edit {$otherSingularHumanName}', true), array('controller'=> '{$otherControllerPath}', 'action'=>'edit', \${$singularVar}['{$assocName}']['{$otherPrimaryKey}']));?></li>\n";?>
</ul>
</div>
</div>
@ -133,17 +133,17 @@ foreach ($relations as $assocName => $assocData):
$assocKey = Inflector::underscore($assocName);
$otherPluralHumanName = Inflector::humanize(Inflector::pluralize($assocKey));
$otherSingularHumanName = Inflector::humanize($assocKey);
$otherFields = $otherModelObj->_tableInfo->value;
$otherFields = array_keys($otherModelObj->schema());
$otherPrimaryKey = $otherModelObj->primaryKey;
?>
<div class="related">
<h3><?php echo "<?php echo sprintf(__('Related %s', true), __('{$otherPluralHumanName}', true));?>";?></h3>
<h3><?php echo "<?php echo __('Related {$otherPluralHumanName}', true);?>";?></h3>
<?php echo "<?php if (!empty(\${$singularVar}['{$assocName}'])):?>\n";?>
<table cellpadding = "0" cellspacing = "0">
<tr>
<?php
foreach ($otherFields as $field) {
echo "\t\t<th><?php __('".Inflector::humanize($field['name'])."') ?></th>\n";
echo "\t\t<th><?php __('".Inflector::humanize($field)."') ?></th>\n";
}
?>
<th class="actions"><?php echo "<?php __('Actions');?>";?></th>
@ -160,7 +160,7 @@ echo "\t<?php
echo "\t\t<tr<?php echo \$class;?>>\n";
foreach ($otherFields as $field) {
echo "\t\t\t<td><?php echo \${$otherSingularVar}['{$field['name']}'];?></td>\n";
echo "\t\t\t<td><?php echo \${$otherSingularVar}['{$field}'];?></td>\n";
}
echo "\t\t\t<td class=\"actions\">\n";

View file

@ -272,7 +272,7 @@ class DB_ACL extends AclBase {
return false;
}
$permKeys = $this->_getAcoKeys($this->Aro->Permission->loadInfo());
$permKeys = $this->_getAcoKeys($this->Aro->Permission->schema());
$aroPath = $this->Aro->node($aro);
$acoPath = new Set($this->Aco->node($aco));
@ -349,7 +349,7 @@ class DB_ACL extends AclBase {
*/
function allow($aro, $aco, $actions = "*", $value = 1) {
$perms = $this->getAclLink($aro, $aco);
$permKeys = $this->_getAcoKeys($this->Aro->Permission->loadInfo());
$permKeys = $this->_getAcoKeys($this->Aro->Permission->schema());
$save = array();
if ($perms == false) {
@ -362,7 +362,7 @@ class DB_ACL extends AclBase {
}
if ($actions == "*") {
$permKeys = $this->_getAcoKeys($this->Aro->Permission->loadInfo());
$permKeys = $this->_getAcoKeys($this->Aro->Permission->schema());
foreach ($permKeys as $key) {
$save[$key] = $value;
@ -477,8 +477,7 @@ class DB_ACL extends AclBase {
*/
function _getAcoKeys($keys) {
$newKeys = array();
$keys = $keys->extract('{n}.name');
$keys = array_keys($keys);
foreach ($keys as $key) {
if (!in_array($key, array('id', 'aro_id', 'aco_id'))) {
$newKeys[] = $key;

View file

@ -365,7 +365,7 @@ class Controller extends Object {
* @access public
*/
function loadModel($modelClass = null, $id = false) {
if($modelClass === null) {
if ($modelClass === null) {
$modelClass = $this->modelClass;
}
$cached = false;
@ -817,7 +817,7 @@ class Controller extends Object {
$modelClass = $this->modelClass;
}
$fields = $this->{$modelClass}->schema();
foreach ($fields->value as $field => $value) {
foreach ($fields as $field => $value) {
if (in_array($value['type'], array('datetime', 'timestamp', 'date', 'time'))) {
$useNewDate = false;
$date = array();
@ -868,7 +868,7 @@ class Controller extends Object {
$time = join(':', array_values($time));
}
if($date && $time) {
if ($date && $time) {
$date = $date . ' ' . $time;
} elseif (is_string($time)) {
$date = $time;

View file

@ -143,10 +143,8 @@ class Scaffold extends Object {
$var = $this->__passedVars[$j];
$this->{$var} = $controller->{$var};
}
$this->redirect = array('action'=> 'index');
if (!is_null($this->plugin)) {
$this->redirect = '/' . $this->plugin . '/' . $this->viewPath;
}
if (!in_array('Form', $this->controller->helpers)) {
$this->controller->helpers[] = 'Form';
@ -180,7 +178,7 @@ class Scaffold extends Object {
$pluralVar = Inflector::variable($this->controller->name);
$singularHumanName = Inflector::humanize($modelClass);
$pluralHumanName = Inflector::humanize($this->controller->name);
$fields = $this->ScaffoldModel->_tableInfo->value;
$fields = array_keys($this->ScaffoldModel->schema());
$foreignKeys = $this->ScaffoldModel->keyToTable;
$belongsTo = $this->ScaffoldModel->belongsTo;
$hasOne = $this->ScaffoldModel->hasOne;

View file

@ -440,4 +440,4 @@ if (!defined('DISABLE_DEFAULT_ERROR_HANDLING')) {
Debugger::invoke(Debugger::getInstance());
}
?>
?>

View file

@ -728,4 +728,4 @@ class TreeBehavior extends ModelBehavior {
$model->updateAll(array($field => $field . ' ' . $dir . ' ' . $shift), $conditions);
}
}
?>
?>

View file

@ -346,9 +346,7 @@ class DboAdodb extends DboSource {
}
$fields = array_map('trim', $fields);
} else {
foreach ($model->_tableInfo->value as $field) {
$fields[] = $field['name'];
}
$fields = array_keys($model->schema());
}
}

View file

@ -727,8 +727,8 @@ class DboSource extends DataSource {
$with = $model->hasAndBelongsToMany[$association]['with'];
$foreignKey = $model->hasAndBelongsToMany[$association]['foreignKey'];
$habtmFields = $model->{$with}->loadInfo();
$habtmFields = $habtmFields->extract('{n}.name');
$habtmFields = $model->{$with}->schema();
$habtmFields = array_keys($habtmFields);
$habtmFieldsCount = count($habtmFields);
$q = $this->insertQueryData($query, null, $association, $assocData, $model, $linkModel, $stack);
@ -774,7 +774,7 @@ class DboSource extends DataSource {
if ($type == 'hasAndBelongsToMany') {
$merge = array();
foreach($fetch as $j => $data) {
if(isset($data[$with]) && $data[$with][$foreignKey] === $row[$model->alias][$model->primaryKey]) {
if (isset($data[$with]) && $data[$with][$foreignKey] === $row[$model->alias][$model->primaryKey]) {
if ($habtmFieldsCount > 2) {
$merge[] = $data;
} else {
@ -1130,9 +1130,8 @@ class DboSource extends DataSource {
$joinAlias = $joinTbl;
if (isset($assocData['with']) && !empty($assocData['with'])) {
$joinFields = $model->{$assocData['with']}->loadInfo();
$joinFields = $joinFields->extract('{n}.name');
$joinFields = $model->{$assocData['with']}->schema();
$joinFields = array_keys($joinFields);
if (is_array($joinFields) && !empty($joinFields)) {
$joinFields = $this->fields($model->{$assocData['with']}, $model->{$assocData['with']}->alias, $joinFields);
$joinAssoc = $joinAlias = $model->{$assocData['with']}->alias;
@ -1433,11 +1432,11 @@ class DboSource extends DataSource {
}
}
if (empty($fields)) {
$fieldData = $model->loadInfo();
$fields = $fieldData->extract('{n}.name');
$fields = array_keys($model->schema());
} else {
$fields = array_filter($fields);
}
if (!$quote) {
return $fields;
}
@ -1918,9 +1917,9 @@ class DboSource extends DataSource {
if (isset($col['key']) && $col['key'] == 'primary') {
$primary = $name;
}
if($name !== 'indexes') {
if ($name !== 'indexes') {
$col['name'] = $name;
if(!isset($col['type'])) {
if (!isset($col['type'])) {
$col['type'] = 'string';
}
$cols[] = $this->buildColumn($col);
@ -1928,7 +1927,7 @@ class DboSource extends DataSource {
$index[] = $this->buildIndex($col);
}
}
if(empty($index) && !empty($primary)) {
if (empty($index) && !empty($primary)) {
$col = array('PRIMARY' => array('column'=> $primary, 'unique' => 1));
$index[] = $this->buildIndex($col);
}
@ -2031,4 +2030,4 @@ class DboSource extends DataSource {
return false;
}
}
?>
?>

View file

@ -285,4 +285,4 @@ class Permission extends AppModel {
parent::__construct();
}
}
?>
?>

View file

@ -653,7 +653,7 @@ class Model extends Overloadable {
}
$duplicate = false;
if(ClassRegistry::isKeySet($colKey)) {
if (ClassRegistry::isKeySet($colKey)) {
$model = ClassRegistry::getObject($colKey);
if (is_a($model, $className)) {
$duplicate = true;
@ -751,8 +751,8 @@ class Model extends Overloadable {
$this->{$type}[$assocKey]['joinTable'] = $this->{$joinClass}->table;
}
if (count($this->{$joinClass}->_schema->value) > 2) {
if (isset($this->{$joinClass}->_schema->value['id'])) {
if (count($this->{$joinClass}->_schema) > 2) {
if (isset($this->{$joinClass}->_schema['id'])) {
$this->{$joinClass}->primaryKey = 'id';
}
}
@ -777,12 +777,11 @@ class Model extends Overloadable {
'table' => $this->tablePrefix . $tableName)));
}
$this->_tableInfo = null;
$this->_schema = null;
}
$this->table = $this->useTable = $tableName;
$this->tableToModel[$this->table] = $this->alias;
$this->loadInfo();
$this->schema();
}
/**
* This function does two things: 1) it scans the array $one for the primary key,
@ -839,13 +838,13 @@ class Model extends Overloadable {
* @return array Array of table metadata
*/
function schema($clear = false) {
if (!is_object($this->_schema) || $clear) {
if (!is_array($this->_schema) || $clear) {
$db =& ConnectionManager::getDataSource($this->useDbConfig);
$db->cacheSources = $this->cacheSources;
if ($db->isInterfaceSupported('describe') && $this->useTable !== false) {
$this->_schema = new Set($db->describe($this, $clear));
$this->_schema = $db->describe($this, $clear);
} elseif ($this->useTable === false) {
$this->_schema = new Set();
$this->_schema = array();
}
}
return $this->_schema;
@ -856,16 +855,15 @@ class Model extends Overloadable {
* @deprecated
*/
function loadInfo($clear = false) {
if (!is_object($this->_tableInfo) || $clear) {
$info = $this->schema($clear);
$info = $this->schema($clear);
if (is_array($info)) {
$fields = array();
foreach($info->value as $field => $value) {
foreach($info as $field => $value) {
$fields[] = am(array('name'=> $field), $value);
}
unset($info);
$this->_tableInfo = new Set($fields);
return new Set($fields);
}
return $this->_tableInfo;
}
/**
* Returns an associative array of field names and column types.
@ -873,13 +871,15 @@ class Model extends Overloadable {
* @return array
*/
function getColumnTypes() {
$columns = $this->loadInfo();
$names = $columns->extract('{n}.name');
$types = $columns->extract('{n}.type');
if (!count($names) || !count($types)) {
trigger_error(__('(Model::getColumnTypes) Unable to build model field data. If you are using a model without a database table, try implementing loadInfo()', true), E_USER_WARNING);
$columns = $this->schema();
if (empty($columns)) {
trigger_error(__('(Model::getColumnTypes) Unable to build model field data. If you are using a model without a database table, try implementing schema()', true), E_USER_WARNING);
}
return array_combine($names, $types);
$cols = array();
foreach ($columns as $field => $values) {
$cols[$field] = $values['type'];
}
return $cols;
}
/**
* Returns the column type of a column in the model
@ -888,9 +888,12 @@ class Model extends Overloadable {
* @return string Column type
*/
function getColumnType($column) {
$cols = $this->getColumnTypes();
if (isset($cols[$column])) {
return $cols[$column];
$cols = $this->schema();
if (empty($cols)) {
trigger_error(__('(Model::getColumnType) Unable to locate model field data. If you are using a model without a database table, try implementing schema()', true), E_USER_WARNING);
}
if (isset($cols[$column]['type'])) {
return $cols[$column]['type'];
}
return null;
}
@ -910,12 +913,12 @@ class Model extends Overloadable {
return false;
}
if (empty($this->_tableInfo)) {
$this->loadInfo();
if (empty($this->_schema)) {
$this->schema();
}
if ($this->_tableInfo != null) {
return in_array($name, $this->_tableInfo->extract('{n}.name'));
if ($this->_schema != null) {
return isset($this->_schema[$name]);
}
return false;
}
@ -929,20 +932,12 @@ class Model extends Overloadable {
$this->id = false;
$this->data = array();
$defaults = array();
$cols = $this->loadInfo();
$names = $cols->extract('{n}.name');
$values = $cols->extract('{n}.default');
if (!empty($names) && !empty($values)) {
$count = count($names);
for ($i = 0; $i < $count; $i++) {
if ($names[$i] != $this->primaryKey) {
$defaults[$names[$i]] = $values[$i];
}
$fields = $this->schema();
foreach ($fields as $field => $properties) {
if ($this->primaryKey !== $field && isset($properties['default'])) {
$defaults[$field] = $properties['default'];
}
}
$this->validationErrors = array();
$this->set(Set::filter($defaults));
$this->set($data);
@ -1126,9 +1121,10 @@ class Model extends Overloadable {
$success = false;
}
} else {
foreach ($this->_tableInfo->value as $key => $value) {
if (in_array($this->primaryKey, $value)) {
if (empty($this->data[$this->alias][$this->primaryKey]) && $this->_tableInfo->value[$key]['type'] === 'string' && $this->_tableInfo->value[$key]['length'] === 36) {
foreach ($this->_schema as $field => $properties) {
if ($this->primaryKey === $field) {
if (empty($this->data[$this->alias][$this->primaryKey]) && $this->_schema[$field]['type'] === 'string' && $this->_schema[$field]['length'] === 36) {
$fields[] = $this->primaryKey;
$values[] = String::uuid();
}
@ -1164,7 +1160,7 @@ class Model extends Overloadable {
}
}
$this->afterSave($created);
if(!empty($this->data)) {
if (!empty($this->data)) {
$success = $this->data;
}
$this->data = false;

View file

@ -141,7 +141,7 @@ class CakeSchema extends Object {
if (file_exists($path . DS . $file)) {
require_once($path . DS . $file);
$class = $name .'Schema';
if(class_exists($class)) {
if (class_exists($class)) {
$Schema =& new $class();
$this->_build($options);
return $Schema;
@ -171,32 +171,32 @@ class CakeSchema extends Object {
loadModel(null);
$tables = array();
$currentTables = $db->sources();
if(isset($db->config['prefix'])) {
if (isset($db->config['prefix'])) {
$prefix = $db->config['prefix'];
}
if (empty($models) && $models !== false) {
$models = Configure::listObjects('model');
}
if(is_array($models)) {
if (is_array($models)) {
foreach ($models as $model) {
if (!class_exists($model)) {
loadModel($model);
}
if(class_exists($model)) {
if (class_exists($model)) {
$Object =& new $model();
$Object->setDataSource($connection);
$table = $db->fullTableName($Object, false);
if (is_object($Object)) {
$table = $db->fullTableName($Object, false);
if(in_array($table, $currentTables)) {
if (in_array($table, $currentTables)) {
$key = array_search($table, $currentTables);
if(empty($tables[$Object->table])) {
if (empty($tables[$Object->table])) {
$tables[$Object->table] = $this->__columns($Object);
$tables[$Object->table]['indexes'] = $db->index($Object);
unset($currentTables[$key]);
}
if(!empty($Object->hasAndBelongsToMany)) {
if (!empty($Object->hasAndBelongsToMany)) {
foreach($Object->hasAndBelongsToMany as $Assoc => $assocData) {
if (isset($assocData['with'])) {
$class = $assocData['with'];
@ -205,7 +205,7 @@ class CakeSchema extends Object {
}
if (is_object($Object->$class)) {
$table = $db->fullTableName($Object->$class, false);
if(in_array($table, $currentTables)) {
if (in_array($table, $currentTables)) {
$key = array_search($table, $currentTables);
$tables[$Object->$class->table] = $this->__columns($Object->$class);
$tables[$Object->$class->table]['indexes'] = $db->index($Object->$class);
@ -219,13 +219,13 @@ class CakeSchema extends Object {
}
}
}
if(!empty($currentTables)) {
if (!empty($currentTables)) {
foreach($currentTables as $table) {
if($prefix) {
if ($prefix) {
$table = str_replace($prefix, '', $table);
}
$Object = new AppModel(array('name'=> Inflector::classify($table), 'table'=> $table, 'ds'=> $connection));
if(in_array($table, array('aros', 'acos', 'aros_acos', Configure::read('Session.table'), 'i18n'))) {
if (in_array($table, array('aros', 'acos', 'aros_acos', Configure::read('Session.table'), 'i18n'))) {
$tables[$Object->table] = $this->__columns($Object);
$tables[$Object->table]['indexes'] = $db->index($Object);
} else {
@ -279,17 +279,17 @@ class CakeSchema extends Object {
$out .= "\tfunction before(\$event = array()) {\n\t\treturn true;\n\t}\n\n\tfunction after(\$event = array()) {\n\t}\n\n";
if(empty($tables)) {
if (empty($tables)) {
$this->read();
}
foreach ($tables as $table => $fields) {
if(!is_numeric($table) && $table !== 'missing') {
if (!is_numeric($table) && $table !== 'missing') {
$out .= "\tvar \${$table} = array(\n";
if (is_array($fields)) {
$cols = array();
foreach ($fields as $field => $value) {
if($field != 'indexes') {
if ($field != 'indexes') {
if (is_string($value)) {
$type = $value;
$value = array('type'=> $type);
@ -354,7 +354,7 @@ class CakeSchema extends Object {
}
$tables = array();
foreach ($new as $table => $fields) {
if($table == 'missing') {
if ($table == 'missing') {
break;
}
if (!array_key_exists($table, $old)) {
@ -398,9 +398,9 @@ class CakeSchema extends Object {
*/
function __values($values) {
$vals = array();
if(is_array($values)) {
if (is_array($values)) {
foreach ($values as $key => $val) {
if(is_array($val)) {
if (is_array($val)) {
$vals[] = "'{$key}' => array('".join("', '", $val)."')";
} else if (!is_numeric($key)) {
$prop = "'{$key}' => ";
@ -430,7 +430,7 @@ class CakeSchema extends Object {
$db =& ConnectionManager::getDataSource($Obj->useDbConfig);
$fields = $Obj->schema(true);
$columns = $props = array();
foreach ($fields->value as $name => $value) {
foreach ($fields as $name => $value) {
if ($Obj->primaryKey == $name) {
$value['key'] = 'primary';

View file

@ -43,12 +43,12 @@ class FormHelper extends AppHelper {
*/
var $helpers = array('Html');
/**
* Holds the fields array('field_name' => 'type'), sizes array('field_name' => 'size'),
* Holds the fields array('field_name' => array('type'=> 'string', 'length'=> 100),
* primaryKey and validates array('field_name')
*
* @access public
*/
var $fieldset = array('fields' => array(), 'sizes' => array(), 'key' => 'id', 'validates' => array());
var $fieldset = array('fields' => array(), 'key' => 'id', 'validates' => array());
/**
* Enter description here...
*
@ -119,19 +119,12 @@ class FormHelper extends AppHelper {
$created = $id = false;
if (isset($object)) {
$fields = $object->loadInfo();
$fieldNames = $fields->extract('{n}.name');
$fieldTypes = $fields->extract('{n}.type');
$fieldLengths = $fields->extract('{n}.length');
if (!count($fieldNames) || !count($fieldTypes)) {
trigger_error(__('(FormHelper::create) Unable to use model field data. If you are using a model without a database table, try implementing loadInfo()', true), E_USER_WARNING);
}
if (!count($fieldNames) || !count($fieldLengths) || (count($fieldNames) != count($fieldTypes))) {
trigger_error(__('(FormHelper::create) Unable to use model field data. If you are using a model without a database table, try implementing loadInfo()', true), E_USER_WARNING);
$fields = $object->schema();
if (empty($fields)) {
trigger_error(__('(FormHelper::create) Unable to use model field data. If you are using a model without a database table, try implementing schema()', true), E_USER_WARNING);
}
$data = array(
'fields' => array_combine($fieldNames, $fieldTypes),
'sizes' => array_combine($fieldNames, $fieldLengths),
'fields' => $fields,
'key' => $object->primaryKey,
'validates' => (ife(empty($object->validate), array(), array_keys($object->validate)))
);
@ -498,7 +491,7 @@ class FormHelper extends AppHelper {
} elseif (in_array($this->field(), array('psword', 'passwd', 'password'))) {
$options['type'] = 'password';
} elseif (isset($this->fieldset['fields'][$this->field()])) {
$type = $this->fieldset['fields'][$this->field()];
$type = $this->fieldset['fields'][$this->field()]['type'];
$primaryKey = $this->fieldset['key'];
} elseif (ClassRegistry::isKeySet($this->model())) {
$model =& ClassRegistry::getObject($this->model());
@ -543,8 +536,8 @@ class FormHelper extends AppHelper {
}
if (!array_key_exists('maxlength', $options) && $options['type'] == 'text') {
if (isset($this->fieldset['sizes'][$this->field()])) {
$options['maxlength'] = $this->fieldset['sizes'][$this->field()];
if (isset($this->fieldset['fields'][$this->field()]['length'])) {
$options['maxlength'] = $this->fieldset['fields'][$this->field()]['length'];
}
}
@ -1449,4 +1442,4 @@ class FormHelper extends AppHelper {
return $this->__options[$name];
}
}
?>
?>

View file

@ -725,4 +725,4 @@ class HtmlHelper extends AppHelper {
}
}
}
?>
?>

View file

@ -34,7 +34,7 @@ echo $paginator->counter(array(
<table cellpadding="0" cellspacing="0">
<tr>
<?php foreach ($fields as $field):?>
<th><?php echo $paginator->sort("{$field['name']}");?></th>
<th><?php echo $paginator->sort("{$field}");?></th>
<?php endforeach;?>
<th><?php __('Actions');?></th>
</tr>
@ -47,15 +47,14 @@ foreach (${$pluralVar} as ${$singularVar}):
}
echo "\n";
echo "\t<tr" . $class . ">\n";
foreach ($fields as $field) {
if (in_array($field['name'], array_keys($foreignKeys))) {
$otherModelClass = $foreignKeys[$field['name']][1];
if (in_array($field, array_keys($foreignKeys))) {
$otherModelClass = $foreignKeys[$field][1];
$otherModelKey = Inflector::underscore($otherModelClass);
$otherControllerName = Inflector::pluralize($otherModelClass);
$otherControllerPath = Inflector::underscore($otherControllerName);
if (isset($foreignKeys[$field['name']][2])) {
$otherModelClass = $foreignKeys[$field['name']][2];
if (isset($foreignKeys[$field][2])) {
$otherModelClass = $foreignKeys[$field][2];
}
$otherVariableName = Inflector::variable($otherModelClass);
$otherModelObj =& ClassRegistry::getObject($otherModelKey);
@ -63,7 +62,7 @@ echo "\n";
$otherDisplayField = $otherModelObj->displayField;
echo "\t\t<td>\n\t\t\t" . $html->link(${$singularVar}[$otherModelClass][$otherDisplayField], array('controller'=> $otherControllerPath, 'action'=>'view', ${$singularVar}[$otherModelClass][$otherPrimaryKey])) . "\n\t\t</td>\n";
} else {
echo "\t\t<td>\n\t\t\t" . ${$singularVar}[$modelClass][$field['name']] . " \n\t\t</td>\n";
echo "\t\t<td>\n\t\t\t" . ${$singularVar}[$modelClass][$field] . " \n\t\t</td>\n";
}
}

View file

@ -35,13 +35,13 @@ foreach ($fields as $field) {
$class = ' class="altrow"';
}
if (in_array($field['name'], array_keys($foreignKeys))) {
$otherModelClass = $foreignKeys[$field['name']][1];
if (in_array($field, array_keys($foreignKeys))) {
$otherModelClass = $foreignKeys[$field][1];
$otherModelKey = Inflector::underscore($otherModelClass);
$otherControllerName = Inflector::pluralize($otherModelClass);
$otherControllerPath = Inflector::underscore($otherControllerName);
if (isset($foreignKeys[$field['name']][2])) {
$otherModelClass = $foreignKeys[$field['name']][2];
if (isset($foreignKeys[$field][2])) {
$otherModelClass = $foreignKeys[$field][2];
}
$otherSingularVar = Inflector::variable($otherModelClass);
$otherModelObj =& ClassRegistry::getObject($otherModelKey);
@ -50,8 +50,8 @@ foreach ($fields as $field) {
echo "\t\t<dt{$class}>".Inflector::humanize($otherModelClass)."</dt>\n";
echo "\t\t<dd{$class}>\n\t\t\t".$html->link(${$singularVar}[$otherModelClass][$otherDisplayField], array('controller'=> $otherControllerPath, 'action'=>'view', ${$singularVar}[$otherModelClass][$otherPrimaryKey])). "\n\t\t\t&nbsp;\n\t\t</dd>\n";
} else {
echo "\t\t<dt{$class}>".Inflector::humanize($field['name'])."</dt>\n";
echo "\t\t<dd{$class}>\n\t\t\t" . ${$singularVar}[$modelClass][$field['name']] . "\n\t\t\t&nbsp;\n\t\t</dd>\n";
echo "\t\t<dt{$class}>".Inflector::humanize($field)."</dt>\n";
echo "\t\t<dd{$class}>\n\t\t\t" . ${$singularVar}[$modelClass][$field] . "\n\t\t\t&nbsp;\n\t\t</dd>\n";
}
}
?>
@ -90,7 +90,7 @@ foreach ($hasOne as $assocName => $assocData):
$otherPluralHumanName = Inflector::humanize(Inflector::pluralize($assocKey));
$otherSingularHumanName = Inflector::humanize($assocKey);
$otherModelObj =& ClassRegistry::getObject($otherModelKey);
$otherFields = $otherModelObj->_tableInfo->value;
$otherFields = array_keys($otherModelObj->schema());
$otherPrimaryKey = $otherModelObj->primaryKey;
?>
<div class="related">
@ -104,8 +104,8 @@ foreach ($hasOne as $assocName => $assocData):
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
echo "\t\t<dt{$class}>".Inflector::humanize($field['name'])."</dt>\n";
echo "\t\t<dd{$class}>\n\t" .${$singularVar}[$assocName][$field['name']] ."\n&nbsp;</dd>\n";
echo "\t\t<dt{$class}>".Inflector::humanize($field)."</dt>\n";
echo "\t\t<dd{$class}>\n\t" .${$singularVar}[$assocName][$field] ."\n&nbsp;</dd>\n";
}
?>
</dl>
@ -130,7 +130,7 @@ foreach ($relations as $assocName => $assocData):
$assocKey = Inflector::underscore($assocName);
$otherPluralHumanName = Inflector::humanize(Inflector::pluralize($assocKey));
$otherSingularHumanName = Inflector::humanize($assocKey);
$otherFields = $otherModelObj->_tableInfo->value;
$otherFields = array_keys($otherModelObj->schema());;
$otherPrimaryKey = $otherModelObj->primaryKey;
?>
<div class="related">
@ -143,7 +143,7 @@ foreach ($relations as $assocName => $assocData):
<tr>
<?php
foreach ($otherFields as $field) {
echo "\t\t<th>".Inflector::humanize($field['name'])."</th>\n";
echo "\t\t<th>".Inflector::humanize($field)."</th>\n";
}
?>
<th class="actions">Actions</th>
@ -158,7 +158,7 @@ foreach ($relations as $assocName => $assocData):
echo "\t\t<tr{$class}>\n";
foreach ($otherFields as $field) {
echo "\t\t\t<td>".${$otherSingularVar}[$field['name']]."</td>\n";
echo "\t\t\t<td>".${$otherSingularVar}[$field]."</td>\n";
}
echo "\t\t\t<td class=\"actions\">\n";

View file

@ -687,4 +687,4 @@ class DispatcherTest extends UnitTestCase {
$_GET = $this->_get;
}
}
?>
?>

View file

@ -336,4 +336,4 @@ class AuthTest extends CakeTestCase {
unset($this->Controller, $this->AuthUser);
}
}
?>
?>

View file

@ -72,4 +72,4 @@ class EmailTest extends CakeTestCase {
}
}
}
?>
?>

View file

@ -771,4 +771,4 @@ class NumberTreeCase extends CakeTestCase {
$this->assertEqual($total, $expects);
}
}
?>
?>

View file

@ -72,7 +72,7 @@
}
function schema() {
return new Set(array(
return array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'client_id' => array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'),
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
@ -91,7 +91,7 @@
'last_login'=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
));
);
}
}

View file

@ -72,7 +72,7 @@ class MysqlTestModel extends Model {
}
function schema() {
return new Set(array(
return array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'client_id' => array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'),
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
@ -91,7 +91,7 @@ class MysqlTestModel extends Model {
'last_login'=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
));
);
}
}
/**

View file

@ -72,7 +72,7 @@ class PostgresTestModel extends Model {
}
function schema() {
return new Set(array(
return array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'client_id' => array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'),
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
@ -91,7 +91,7 @@ class PostgresTestModel extends Model {
'last_login'=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
));
);
}
}
/**

View file

@ -51,27 +51,30 @@ class TestModel extends CakeTestModel {
return $conditions;
}
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'client_id', 'type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'login', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'passwd', 'type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
array('name' => 'addr_1', 'type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
array('name' => 'addr_2', 'type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'),
array('name' => 'zip_code', 'type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
array('name' => 'city', 'type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
array('name' => 'country', 'type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
array('name' => 'phone', 'type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
array('name' => 'fax', 'type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
array('name' => 'url', 'type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
array('name' => 'email', 'type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
array('name' => 'comments', 'type' => 'text', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'last_login', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
));
function schema() {
if (!isset($this->_schema)) {
$this->_schema = array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'client_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '11'),
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'),
'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => '155'),
'last_login' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
}
return $this->_schema;
}
}
/**
@ -129,17 +132,16 @@ class TestModel4 extends CakeTestModel {
'associationForeignKey' => 'test_model7_id'
));
function loadInfo() {
if (!isset($this->_tableInfo)) {
$this->_tableInfo = new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
));
function schema() {
if (!isset($this->_schema)) {
$this->_schema = array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
}
return $this->_tableInfo;
return $this->_schema;
}
}
/**
@ -163,18 +165,17 @@ class TestModel5 extends CakeTestModel {
'foreignKey' => 'test_model5_id'
));
function loadInfo() {
if (!isset($this->_tableInfo)) {
$this->_tableInfo = new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'test_model4_id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
));
function schema() {
if (!isset($this->_schema)) {
$this->_schema = array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'test_model4_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
}
return $this->_tableInfo;
return $this->_schema;
}
}
/**
@ -194,18 +195,17 @@ class TestModel6 extends CakeTestModel {
'foreignKey' => 'test_model5_id'
));
function loadInfo() {
if (!isset($this->_tableInfo)) {
$this->_tableInfo = new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'test_model5_id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
));
function schema() {
if (!isset($this->_schema)) {
$this->_schema = array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'test_model5_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
}
return $this->_tableInfo;
return $this->_schema;
}
}
/**
@ -220,16 +220,16 @@ class TestModel7 extends CakeTestModel {
var $table = 'test_model7';
var $useTable = false;
function loadInfo() {
if (!isset($this->_tableInfo)) {
$this->_tableInfo = new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
));
function schema() {
if (!isset($this->_schema)) {
$this->_schema = array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
}
return $this->_tableInfo;
return $this->_schema;
}
}
/**
@ -252,18 +252,17 @@ class TestModel8 extends CakeTestModel {
)
);
function loadInfo() {
if (!isset($this->_tableInfo)) {
$this->_tableInfo = new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'test_model9_id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
));
function schema() {
if (!isset($this->_schema)) {
$this->_schema = array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'test_model9_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
}
return $this->_tableInfo;
return $this->_schema;
}
}
/**
@ -284,18 +283,17 @@ class TestModel9 extends CakeTestModel {
'conditions' => 'TestModel8.name != \'larry\''
));
function loadInfo() {
if (!isset($this->_tableInfo)) {
$this->_tableInfo = new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'test_model8_id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
));
function schema() {
if (!isset($this->_schema)) {
$this->_schema = array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'test_model8_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '11'),
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
}
return $this->_tableInfo;
return $this->_schema;
}
}
@ -314,14 +312,14 @@ class Level extends CakeTestModel {
)
);
function loadInfo() {
if (!isset($this->_tableInfo)) {
$this->_tableInfo = new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
array('name' => 'name', 'type' => 'string', 'null' => true, 'default' => null, 'length' => '20')
));
function schema() {
if (!isset($this->_schema)) {
$this->_schema = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20'),
);
}
return $this->_tableInfo;
return $this->_schema;
}
}
@ -335,16 +333,17 @@ class Group extends CakeTestModel {
var $hasMany = array('Category2', 'User2');
function loadInfo() {
if (!isset($this->_tableInfo)) {
$this->_tableInfo = new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
array('name' => 'level_id', 'type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
array('name' => 'name', 'type' => 'string', 'null' => true, 'default' => null, 'length' => '20')
));
function schema() {
if (!isset($this->_schema)) {
$this->_schema = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
'level_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20'),
);
}
return $this->_tableInfo;
return $this->_schema;
}
}
class User2 extends CakeTestModel {
@ -368,16 +367,16 @@ class User2 extends CakeTestModel {
),
);
function loadInfo() {
if (!isset($this->_tableInfo)) {
$this->_tableInfo = new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
array('name' => 'group_id', 'type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
array('name' => 'level_id', 'type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
array('name' => 'name', 'type' => 'string', 'null' => true, 'default' => null, 'length' => '20')
));
function schema() {
if (!isset($this->_schema)) {
$this->_schema = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
'group_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
'level_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20'),
);
}
return $this->_tableInfo;
return $this->_schema;
}
}
@ -409,18 +408,19 @@ class Category2 extends CakeTestModel {
'limit'=>'3')
);
function loadInfo() {
if (!isset($this->_tableInfo)) {
$this->_tableInfo = new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
array('name' => 'group_id', 'type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
array('name' => 'parent_id', 'type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
array('name' => 'name', 'type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
array('name' => 'icon', 'type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
array('name' => 'description', 'text' => 'string', 'null' => false, 'default' => '', 'length' => null)
));
function schema() {
if (!isset($this->_schema)) {
$this->_schema = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
'group_id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
'parent_id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
'name' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
'icon' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
'description' => array('type' => 'text', 'null' => false, 'default' => '', 'length' => null),
);
}
return $this->_tableInfo;
return $this->_schema;
}
}
@ -438,31 +438,31 @@ class Article2 extends CakeTestModel {
)
);
function loadInfo() {
if (!isset($this->_tableInfo)) {
$this->_tableInfo = new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
array('name' => 'category_id', 'type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
array('name' => 'user_id', 'type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
array('name' => 'rate_count', 'type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
array('name' => 'rate_sum', 'type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
array('name' => 'viewed', 'type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
array('name' => 'version', 'type' => 'string', 'null' => true, 'default' => '', 'length' => '45'),
array('name' => 'title', 'type' => 'string', 'null' => false, 'default' => '', 'length' => '200'),
array('name' => 'intro', 'text' => 'string', 'null' => true, 'default' => '', 'length' => null),
array('name' => 'comments', 'type' => 'integer', 'null' => false, 'default' => '0', 'length' => '4'),
array('name' => 'body', 'text' => 'string', 'null' => true, 'default' => '', 'length' => null),
array('name' => 'isdraft', 'type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
array('name' => 'allow_comments', 'type' => 'boolean', 'null' => false, 'default' => '1', 'length' => '1'),
array('name' => 'moderate_comments', 'type' => 'boolean', 'null' => false, 'default' => '1', 'length' => '1'),
array('name' => 'published', 'type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
array('name' => 'multipage', 'type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
array('name' => 'published_date', 'type' => 'datetime', 'null' => true, 'default' => '', 'length' => null),
array('name' => 'created', 'type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null),
array('name' => 'modified', 'type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null)
));
function schema() {
if (!isset($this->_schema)) {
$this->_schema = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
'category_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
'user_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
'rate_count' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
'rate_sum' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
'viewed' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
'version' => array('type' => 'string', 'null' => true, 'default' => '', 'length' => '45'),
'title' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '200'),
'intro' => array('text' => 'string', 'null' => true, 'default' => '', 'length' => null),
'comments' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '4'),
'body' => array('text' => 'string', 'null' => true, 'default' => '', 'length' => null),
'isdraft' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
'allow_comments' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'length' => '1'),
'moderate_comments' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'length' => '1'),
'published' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
'multipage' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
'published_date' => array('type' => 'datetime', 'null' => true, 'default' => '', 'length' => null),
'created' => array('type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null),
'modified' => array('type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null)
);
}
return $this->_tableInfo;
return $this->_schema;
}
}
@ -471,17 +471,17 @@ class CategoryFeatured2 extends CakeTestModel {
var $table = 'category_featured';
var $useTable = false;
function loadInfo() {
if (!isset($this->_tableInfo)) {
$this->_tableInfo = new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
array('name' => 'parent_id', 'type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
array('name' => 'name', 'type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
array('name' => 'icon', 'type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
array('name' => 'description', 'text' => 'string', 'null' => false, 'default' => '', 'length' => null)
));
function schema() {
if (!isset($this->_schema)) {
$this->_schema = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
'parent_id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
'name' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
'icon' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
'description' => array('text' => 'string', 'null' => false, 'default' => '', 'length' => null)
);
}
return $this->_tableInfo;
return $this->_schema;
}
}
@ -497,16 +497,16 @@ class Featured2 extends CakeTestModel {
)
);
function loadInfo() {
if (!isset($this->_tableInfo)) {
$this->_tableInfo = new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
array('name' => 'article_id', 'type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
array('name' => 'category_id', 'type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
array('name' => 'name', 'type' => 'string', 'null' => true, 'default' => null, 'length' => '20')
));
function schema() {
if (!isset($this->_schema)) {
$this->_schema = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
'article_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
'category_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20')
);
}
return $this->_tableInfo;
return $this->_schema;
}
}
@ -516,16 +516,16 @@ class Comment2 extends CakeTestModel {
var $belongsTo = array('ArticleFeatured2', 'User2');
var $useTable = false;
function loadInfo() {
if (!isset($this->_tableInfo)) {
$this->_tableInfo = new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
array('name' => 'article_featured_id', 'type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
array('name' => 'user_id', 'type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
array('name' => 'title', 'type' => 'string', 'null' => true, 'default' => null, 'length' => '20')
));
function schema() {
if (!isset($this->_schema)) {
$this->_schema = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
'article_featured_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
'user_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20')
);
}
return $this->_tableInfo;
return $this->_schema;
}
}
@ -549,21 +549,21 @@ class ArticleFeatured2 extends CakeTestModel {
'Comment2' => array('className'=>'Comment2', 'dependent' => true)
);
function loadInfo() {
if (!isset($this->_tableInfo)) {
$this->_tableInfo = new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
array('name' => 'category_featured_id', 'type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
array('name' => 'user_id', 'type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
array('name' => 'title', 'type' => 'string', 'null' => false, 'default' => '', 'length' => '200'),
array('name' => 'body', 'text' => 'string', 'null' => true, 'default' => '', 'length' => null),
array('name' => 'published', 'type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
array('name' => 'published_date', 'type' => 'datetime', 'null' => true, 'default' => '', 'length' => null),
array('name' => 'created', 'type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null),
array('name' => 'modified', 'type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null)
));
function schema() {
if (!isset($this->_schema)) {
$this->_schema = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
'category_featured_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
'user_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
'title' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20'),
'body' => array('text' => 'string', 'null' => true, 'default' => '', 'length' => null),
'published' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
'published_date' => array('type' => 'datetime', 'null' => true, 'default' => '', 'length' => null),
'created' => array('type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null),
'modified' => array('type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null)
);
}
return $this->_tableInfo;
return $this->_schema;
}
}
@ -645,7 +645,7 @@ class DboSourceTest extends UnitTestCase {
$this->assertPattern('/^SELECT\s+(.+)FROM(.+)`Category2`\.`group_id`\s+=\s+`Group`\.`id`\)\s+WHERE/', $query);
$this->model = new TestModel4();
$this->model->loadInfo();
$this->model->schema();
$this->_buildRelatedModels($this->model);
$binding = array('type' => 'belongsTo', 'model' => 'TestModel4Parent');
@ -698,7 +698,7 @@ class DboSourceTest extends UnitTestCase {
function testGenerateAssociationQuerySelfJoinWithConditionsInHasOneBinding() {
$this->model = new TestModel8();
$this->model->loadInfo();
$this->model->schema();
$this->_buildRelatedModels($this->model);
$binding = array('type' => 'hasOne', 'model' => 'TestModel9');
@ -722,7 +722,7 @@ class DboSourceTest extends UnitTestCase {
function testGenerateAssociationQuerySelfJoinWithConditionsInBelongsToBinding() {
$this->model = new TestModel9();
$this->model->loadInfo();
$this->model->schema();
$this->_buildRelatedModels($this->model);
$binding = array('type' => 'belongsTo', 'model' => 'TestModel8');
@ -746,7 +746,7 @@ class DboSourceTest extends UnitTestCase {
function testGenerateAssociationQuerySelfJoinWithConditions() {
$this->model = new TestModel4();
$this->model->loadInfo();
$this->model->schema();
$this->_buildRelatedModels($this->model);
$binding = array('type' => 'belongsTo', 'model' => 'TestModel4Parent');
@ -767,7 +767,7 @@ class DboSourceTest extends UnitTestCase {
$this->assertPattern('/\s+WHERE\s+(?:\()?`TestModel4Parent`.`name`\s+!=\s+\'mariano\'(?:\))?\s*$/', $result);
$this->Featured2 = new Featured2();
$this->Featured2->loadInfo();
$this->Featured2->schema();
$this->Featured2->bindModel(array(
'belongsTo' => array(
@ -804,7 +804,7 @@ class DboSourceTest extends UnitTestCase {
function testGenerateAssociationQueryHasOne() {
$this->model = new TestModel4();
$this->model->loadInfo();
$this->model->schema();
$this->_buildRelatedModels($this->model);
$binding = array('type' => 'hasOne', 'model' => 'TestModel5');
@ -831,7 +831,7 @@ class DboSourceTest extends UnitTestCase {
function testGenerateAssociationQueryHasOneWithConditions() {
$this->model = new TestModel4();
$this->model->loadInfo();
$this->model->schema();
$this->_buildRelatedModels($this->model);
$binding = array('type' => 'hasOne', 'model' => 'TestModel5');
@ -855,7 +855,7 @@ class DboSourceTest extends UnitTestCase {
function testGenerateAssociationQueryBelongsTo() {
$this->model = new TestModel5();
$this->model->loadInfo();
$this->model->schema();
$this->_buildRelatedModels($this->model);
$binding = array('type'=>'belongsTo', 'model'=>'TestModel4');
@ -881,7 +881,7 @@ class DboSourceTest extends UnitTestCase {
function testGenerateAssociationQueryBelongsToWithConditions() {
$this->model = new TestModel5();
$this->model->loadInfo();
$this->model->schema();
$this->_buildRelatedModels($this->model);
$binding = array('type' => 'belongsTo', 'model' => 'TestModel4');
@ -907,7 +907,7 @@ class DboSourceTest extends UnitTestCase {
function testGenerateAssociationQueryHasMany() {
$this->model = new TestModel5();
$this->model->loadInfo();
$this->model->schema();
$this->_buildRelatedModels($this->model);
$binding = array('type' => 'hasMany', 'model' => 'TestModel6');
@ -930,7 +930,7 @@ class DboSourceTest extends UnitTestCase {
function testGenerateAssociationQueryHasManyWithLimit() {
$this->model = new TestModel5();
$this->model->loadInfo();
$this->model->schema();
$this->_buildRelatedModels($this->model);
$this->model->hasMany['TestModel6']['limit'] = 2;
@ -960,7 +960,7 @@ class DboSourceTest extends UnitTestCase {
function testGenerateAssociationQueryHasManyWithConditions() {
$this->model = new TestModel5();
$this->model->loadInfo();
$this->model->schema();
$this->_buildRelatedModels($this->model);
$binding = array('type' => 'hasMany', 'model' => 'TestModel6');
@ -983,7 +983,7 @@ class DboSourceTest extends UnitTestCase {
function testGenerateAssociationQueryHasManyWithOffsetAndLimit() {
$this->model = new TestModel5();
$this->model->loadInfo();
$this->model->schema();
$this->_buildRelatedModels($this->model);
$__backup = $this->model->hasMany['TestModel6'];
@ -1014,7 +1014,7 @@ class DboSourceTest extends UnitTestCase {
function testGenerateAssociationQueryHasManyWithPageAndLimit() {
$this->model = new TestModel5();
$this->model->loadInfo();
$this->model->schema();
$this->_buildRelatedModels($this->model);
$__backup = $this->model->hasMany['TestModel6'];
@ -1045,7 +1045,7 @@ class DboSourceTest extends UnitTestCase {
function testGenerateAssociationQueryHasManyWithFields() {
$this->model = new TestModel5();
$this->model->loadInfo();
$this->model->schema();
$this->_buildRelatedModels($this->model);
$binding = array('type' => 'hasMany', 'model' => 'TestModel6');
@ -1165,7 +1165,7 @@ class DboSourceTest extends UnitTestCase {
function testGenerateAssociationQueryHasAndBelongsToMany() {
$this->model = new TestModel4();
$this->model->loadInfo();
$this->model->schema();
$this->_buildRelatedModels($this->model);
$binding = array('type' => 'hasAndBelongsToMany', 'model' => 'TestModel7');
@ -1190,7 +1190,7 @@ class DboSourceTest extends UnitTestCase {
function testGenerateAssociationQueryHasAndBelongsToManyWithConditions() {
$this->model = new TestModel4();
$this->model->loadInfo();
$this->model->schema();
$this->_buildRelatedModels($this->model);
$binding = array('type'=>'hasAndBelongsToMany', 'model'=>'TestModel7');
@ -1213,7 +1213,7 @@ class DboSourceTest extends UnitTestCase {
function testGenerateAssociationQueryHasAndBelongsToManyWithOffsetAndLimit() {
$this->model = new TestModel4();
$this->model->loadInfo();
$this->model->schema();
$this->_buildRelatedModels($this->model);
$__backup = $this->model->hasAndBelongsToMany['TestModel7'];
@ -1245,7 +1245,7 @@ class DboSourceTest extends UnitTestCase {
function testGenerateAssociationQueryHasAndBelongsToManyWithPageAndLimit() {
$this->model = new TestModel4();
$this->model->loadInfo();
$this->model->schema();
$this->_buildRelatedModels($this->model);
$__backup = $this->model->hasAndBelongsToMany['TestModel7'];
@ -1284,7 +1284,7 @@ class DboSourceTest extends UnitTestCase {
$className = $assocData['className'];
}
$model->$className = new $className();
$model->$className->loadInfo();
$model->$className->schema();
}
}
}

View file

@ -45,24 +45,14 @@ class Test extends Model {
var $useTable = false;
var $name = 'Test';
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '1', 'length' => '8', 'key'=>'primary'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'email', 'type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
array('name' => 'notes', 'type' => 'text', 'null' => '1', 'default' => 'write some notes here', 'length' => ''),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)));
}
function schema() {
return new Set(array(
return array(
'id'=> array('type' => 'integer', 'null' => '', 'default' => '1', 'length' => '8', 'key'=>'primary'),
'name'=> array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'email'=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
'notes'=> array('type' => 'text', 'null' => '1', 'default' => 'write some notes here', 'length' => ''),
'created'=> array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated'=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)));
'updated'=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null));
}
}
@ -89,14 +79,15 @@ class TestValidate extends Model {
return false;
}
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'title', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'body', 'type' => 'string', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'number', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'modified', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)));
function schema() {
return array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'title' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'body' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => ''),
'number' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'modified' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
}
}
@ -124,7 +115,7 @@ class Article extends CakeTestModel {
var $validate = array('user_id' => VALID_NUMBER, 'title' => array('allowEmpty' => false, 'rule' => VALID_NOT_EMPTY), 'body' => VALID_NOT_EMPTY);
function titleDuplicate ($title) {
if($title === 'My Article Title') {
if ($title === 'My Article Title') {
return false;
}
return true;
@ -581,10 +572,8 @@ class ModelTest extends CakeTestCase {
$result = $this->model->create();
$expected = array('Test' => array('notes' => 'write some notes here'));
$this->assertEqual($result, $expected);
$this->model =& new User();
$result = $this->model->loadInfo();
$result = $result->value;
$result = $this->model->schema();
$db =& ConnectionManager::getDataSource('test_suite');
if (isset($db->columns['primary_key']['length'])) {
@ -596,17 +585,18 @@ class ModelTest extends CakeTestCase {
}
$expected = array(
array('name' => 'id', 'type' => 'integer', 'null' => false, 'default' => null, 'length' => $intLength, 'key' => 'primary', 'extra' => 'auto_increment'),
array('name' => 'user', 'type' => 'string', 'null' => false, 'default' => '', 'length' => 255),
array('name' => 'password', 'type' => 'string', 'null' => false, 'default' => '', 'length' => 255),
array('name' => 'created', 'type' => 'datetime', 'null' => true, 'default' => null, 'length' => null),
array('name' => 'updated', 'type' => 'datetime', 'null' => true, 'default' => null, 'length' => null));
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => $intLength, 'key' => 'primary', 'extra' => 'auto_increment'),
'user' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => 255),
'password' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => 255),
'created' => array('type' => 'datetime', 'null' => true, 'default' => null, 'length' => null),
'updated'=> array('type' => 'datetime', 'null' => true, 'default' => null, 'length' => null));
$this->assertEqual($result, $expected);
$this->model =& new Article();
$result = $this->model->create();
$expected = array('Article' => array('published' => 'N'));
$this->assertEqual($result, $expected);
}
function testCreationWithMultipleData() {
@ -3010,8 +3000,8 @@ class ValidationTest extends CakeTestModel {
return $data === 1;
}
function loadInfo() {
return new Set();
function schema() {
return array();
}
}

View file

@ -98,4 +98,4 @@ class SanitizeTest extends UnitTestCase {
$this->assertEqual($result, $expected);
}
}
?>
?>

View file

@ -43,12 +43,13 @@ class PostAjaxTest extends Model {
var $primaryKey = 'id';
var $useTable = false;
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)));
function schema() {
return array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
}
}
@ -112,7 +113,7 @@ class AjaxTest extends UnitTestCase {
$this->assertEqual($result, $expected);
$result = $this->Ajax->dropRemote('droppable', array('accept' => 'crap'), array('url' => '/posts'));
$expected = '<script type="text/javascript">Droppables.add(\'droppable\', {accept:\'crap\', onDrop:function(element, droppable) {new Ajax.Request(\'/posts\', {asynchronous:true, evalScripts:true})}});</script>';
$expected = '<script type="text/javascript">Droppables.add(\'droppable\', {accept:\'crap\', onDrop:function(element, droppable, event) {new Ajax.Request(\'/posts\', {asynchronous:true, evalScripts:true})}});</script>';
$this->assertEqual($result, $expected);
}

View file

@ -48,13 +48,14 @@ class Contact extends CakeTestModel {
var $useTable = false;
var $name = 'Contact';
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'published', 'type' => 'date', 'null' => true, 'default' => null, 'length' => null),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)));
function schema() {
return array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'published' => array('type' => 'date', 'null' => true, 'default' => null, 'length' => null),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
}
}
@ -64,13 +65,15 @@ class UserForm extends CakeTestModel {
var $name = 'UserForm';
var $hasMany = array('OpenidUrl' => array('className' => 'OpenidUrl', 'foreignKey' => 'user_form_id'));
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)));
function schema() {
return array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'published' => array('type' => 'date', 'null' => true, 'default' => null, 'length' => null),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
}
}
class OpenidUrl extends CakeTestModel {
@ -79,11 +82,12 @@ class OpenidUrl extends CakeTestModel {
var $name = 'OpenidUrl';
var $belongsTo = array('UserForm' => array('className' => 'UserForm', 'foreignKey' => 'user_form_id'));
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'user_form_id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'url', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),));
function schema() {
return array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'user_form_id' => array('type' => 'user_form_id', 'null' => '', 'default' => '', 'length' => '8'),
'url' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
);
}
function beforeValidate() {
@ -98,13 +102,14 @@ class ValidateUser extends CakeTestModel {
var $name = 'ValidateUser';
var $hasOne = array('ValidateProfile' => array('className' => 'ValidateProfile', 'foreignKey' => 'user_id'));
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'email', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)));
function schema() {
return array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'email' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
}
function beforeValidate() {
@ -120,14 +125,15 @@ class ValidateProfile extends CakeTestModel {
var $hasOne = array('ValidateItem' => array('className' => 'ValidateItem', 'foreignKey' => 'profile_id'));
var $belongsTo = array('ValidateUser' => array('className' => 'ValidateUser', 'foreignKey' => 'user_id'));
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'user_id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'full_name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'city', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)));
function schema() {
return array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'user_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'full_name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'city' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
}
function beforeValidate() {
@ -143,14 +149,15 @@ class ValidateItem extends CakeTestModel {
var $name = 'ValidateItem';
var $belongsTo = array('ValidateProfile' => array('className' => 'ValidateProfile', 'foreignKey' => 'profile_id'));
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'profile_id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'description', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)));
function schema() {
return array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'profile_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'description' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
}
function beforeValidate() {
@ -737,7 +744,7 @@ class FormHelperTest extends CakeTestCase {
$this->assertPattern('/^<input[^<>]+\/><input[^<>]+checked="checked"[^<>]+\/>$/', $result);
$result = $this->Form->checkbox('Model.field', array('value' => 'myvalue'));
$this->assertNoPattern('/^<input[^<>]+[^type|name|id|value]=[^<>]*\/><input[^<>]+\/>$/', $result);
$this->assertNoPattern('/^<input[^<>]+\/><input[^<>]+[^type|name|id|value|class|checked]=[^<>]*>$/', $result);
$this->assertPattern('/^<input[^<>]+id="ModelField_"[^<>]+\/><input[^<>]+\/>$/', $result);
@ -748,7 +755,7 @@ class FormHelperTest extends CakeTestCase {
$this->Form->data['Model']['field'] = '';
$result = $this->Form->checkbox('Model.field', array('id' => 'theID'));
$this->assertNoPattern('/^<input[^<>]+[^type|name|id|value]=[^<>]*\/><input[^<>]+\/>$/', $result);
$this->assertNoPattern('/^<input[^<>]+\/><input[^<>]+[^type|name|id|value|class|checked]=[^<>]*>$/', $result);
$this->assertPattern('/^<input[^<>]+id="theID_"[^<>]+\/><input[^<>]+\/>$/', $result);
@ -756,10 +763,10 @@ class FormHelperTest extends CakeTestCase {
$this->assertPattern('/^<input[^<>]+\/><input[^<>]+id="theID"[^<>]+\/>$/', $result);
$this->assertPattern('/^<input[^<>]+\/><input[^<>]+value="1"[^<>]+\/>$/', $result);
$this->assertNoPattern('/^<input[^<>]+\/><input[^<>]+checked="checked"[^<>]+\/>$/', $result);
unset($this->Form->validationErrors['Model']['field']);
$result = $this->Form->checkbox('Model.field', array('value' => 'myvalue'));
$this->assertNoPattern('/^<input[^<>]+[^type|name|id|value]=[^<>]*\/><input[^<>]+\/>$/', $result);
$this->assertNoPattern('/^<input[^<>]+\/><input[^<>]+[^type|name|id|value|class|checked]=[^<>]*>$/', $result);
$this->assertPattern('/^<input[^<>]+id="ModelField_"[^<>]+\/><input[^<>]+\/>$/', $result);
@ -779,7 +786,7 @@ class FormHelperTest extends CakeTestCase {
$this->assertPattern('/^<input[^<>]+\/><input[^<>]+id="ModelField"[^<>]+\/>$/', $result);
$this->assertPattern('/^<input[^<>]+\/><input[^<>]+value="1"[^<>]+\/>$/', $result);
$this->assertNoPattern('/^<input[^<>]+\/><input[^<>]+checked="checked"[^<>]+\/>$/', $result);
$result = $this->Form->checkbox('Model.field', array('checked' => false));
$this->assertNoPattern('/^<input[^<>]+[^type|name|id|value]=[^<>]*\/><input[^<>]+\/>$/', $result);
$this->assertNoPattern('/^<input[^<>]+\/><input[^<>]+[^type|name|id|value|class|checked]=[^<>]*>$/', $result);
@ -788,11 +795,11 @@ class FormHelperTest extends CakeTestCase {
$this->assertPattern('/^<input[^<>]+\/><input[^<>]+id="ModelField"[^<>]+\/>$/', $result);
$this->assertPattern('/^<input[^<>]+\/><input[^<>]+value="1"[^<>]+\/>$/', $result);
$this->assertNoPattern('/^<input[^<>]+\/><input[^<>]+checked="checked"[^<>]+\/>$/', $result);
$this->Form->validationErrors['Model']['field'] = 1;
$this->Form->data['Contact']['published'] = 1;
$result = $this->Form->checkbox('Contact.published', array('id'=>'theID'));
$this->assertNoPattern('/^<input[^<>]+[^type|name|id|value]=[^<>]*\/><input[^<>]+\/>$/', $result);
$this->assertNoPattern('/^<input[^<>]+\/><input[^<>]+[^type|name|id|value|class|checked]=[^<>]*>$/', $result);
$this->assertPattern('/^<input[^<>]+id="theID_"[^<>]+\/><input[^<>]+\/>$/', $result);
@ -804,7 +811,7 @@ class FormHelperTest extends CakeTestCase {
$this->Form->validationErrors['Model']['field'] = 1;
$this->Form->data['Contact']['published'] = 0;
$result = $this->Form->checkbox('Contact.published', array('id'=>'theID'));
$this->assertNoPattern('/^<input[^<>]+[^type|name|id|value]=[^<>]*\/><input[^<>]+\/>$/', $result);
$this->assertNoPattern('/^<input[^<>]+\/><input[^<>]+[^type|name|id|value|class|checked]=[^<>]*>$/', $result);
$this->assertPattern('/^<input[^<>]+id="theID_"[^<>]+\/><input[^<>]+\/>$/', $result);
@ -1189,7 +1196,7 @@ class FormHelperTest extends CakeTestCase {
function __sortFields($fields) {
foreach ($fields as $key => $value) {
if(strpos($key, '_') !== 0) {
if ($key{0} !== '_') {
sort($fields[$key]);
}
}
@ -1198,4 +1205,4 @@ class FormHelperTest extends CakeTestCase {
}
}
?>
?>

View file

@ -179,4 +179,4 @@ class HtmlHelperTest extends UnitTestCase {
unset($this->Html);
}
}
?>
?>

View file

@ -74,4 +74,4 @@ class CakeHtmlReporter extends HtmlReporter {
print "</div>\n";
}
}
?>
?>

View file

@ -71,8 +71,7 @@ class CakeTestFixture extends Object {
$db =& ConnectionManager::getDataSource($model->useDbConfig);
$db->cacheSources = false;
$this->table = $this->useTable;
$schema = $model->schema(true);
$this->fields = $schema->value;
$this->fields = $model->schema(true);
$this->fields[$model->primaryKey]['key'] = 'primary';
} elseif (isset($import['table'])) {
$model =& new Model(null, $import['table'], $import['connection']);
@ -81,8 +80,7 @@ class CakeTestFixture extends Object {
$model->name = Inflector::camelize(Inflector::singularize($import['table']));
$model->table = $import['table'];
$model->tablePrefix = $db->config['prefix'];
$schema = $model->schema(true);
$this->fields = $schema->value;
$this->fields = $model->schema(true);
}
if ($import['records'] !== false && isset($model) && isset($db)) {

View file

@ -364,4 +364,4 @@ class HtmlTestManager extends TestManager {
return $buffer;
}
}
?>
?>