fix for bake model validations...thanks again, sdevore

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6580 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2008-03-16 04:59:40 +00:00
parent df15244909
commit 0c9023fd1d

View file

@ -246,10 +246,13 @@ class ModelTask extends Shell {
$prompt .= '---------------------------------------------------------------'."\n";
$prompt .= 'Please select one of the following validation options:'."\n";
$prompt .= '---------------------------------------------------------------'."\n";
$choices = array();
$skip = 1;
sort($options);
foreach ($options as $key => $option) {
if ($option{0} != '_') {
$prompt .= "{$key} - {$option}\n";
if ($option{0} != '_' && strtolower($option) != 'getinstance') {
$prompt .= "{$skip} - {$option}\n";
$choices[$skip] = $option;
$skip++;
}
}
@ -279,7 +282,7 @@ class ModelTask extends Shell {
}
if ($choice !== $skip) {
if (is_numeric($choice) && isset($options[$choice])) {
$validate[$fieldName] = $options[$choice];
$validate[$fieldName] = $choices[$choice];
} else {
$validate[$fieldName] = $choice;
}