mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
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:
parent
df15244909
commit
0c9023fd1d
1 changed files with 6 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue