Merge branch 'master' into 2.4

Conflicts:
	lib/Cake/Console/Command/ConsoleShell.php
This commit is contained in:
ADmad 2013-08-04 19:26:55 +05:30
commit 38b050a711
52 changed files with 407 additions and 122 deletions

View file

@ -1637,9 +1637,10 @@ class Model extends Object implements CakeEventListener {
}
if (!empty($options['fieldList'])) {
$this->whitelist = $options['fieldList'];
if (!empty($options['fieldList'][$this->alias]) && is_array($options['fieldList'][$this->alias])) {
$this->whitelist = $options['fieldList'][$this->alias];
} elseif (Hash::dimensions($options['fieldList']) < 2) {
$this->whitelist = $options['fieldList'];
}
} elseif ($options['fieldList'] === null) {
$this->whitelist = array();
@ -2360,7 +2361,10 @@ class Model extends Object implements CakeEventListener {
$options['fieldList'][$this->alias][] = $key;
return $options;
}
if (!empty($options['fieldList']) && is_array($options['fieldList'])) {
if (!empty($options['fieldList']) &&
is_array($options['fieldList']) &&
Hash::dimensions($options['fieldList']) < 2
) {
$options['fieldList'][] = $key;
}
return $options;

View file

@ -21,6 +21,7 @@
*/
App::uses('CakeValidationSet', 'Model/Validator');
App::uses('Hash', 'Utility');
/**
* ModelValidator object encapsulates all methods related to data validations for a model
@ -394,11 +395,11 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable {
}
unset($fieldList);
$validateList = array();
if (empty($whitelist)) {
if (empty($whitelist) || Hash::dimensions($whitelist) > 1) {
return $this->_fields;
}
$validateList = array();
$this->validationErrors = array();
foreach ((array)$whitelist as $f) {
if (!empty($this->_fields[$f])) {