diff --git a/cake/console/templates/skel/config/inflections.php b/cake/console/templates/skel/config/inflections.php index 51e45bef3..085462b3b 100644 --- a/cake/console/templates/skel/config/inflections.php +++ b/cake/console/templates/skel/config/inflections.php @@ -53,19 +53,4 @@ */ $singularRules = array(); -/** - * This is a key only array of singular words that should not be inflected. - * You should not have to change this value below if you do change it use same format - * as the $uninflectedPlural above. - */ - $uninflectedSingular = $uninflectedPlural; - -/** - * This is a key => value array of singular irregular words. - * Most of the time this will be a reverse of the above $irregularPlural array - * You should not have to change this value below if you do change it use same format - * - * $irregularSingular = array('atlases' => 'atlas', 'beefs' => 'beef', 'brothers' => 'brother') - */ - $irregularSingular = array_flip($irregularPlural); ?> \ No newline at end of file diff --git a/cake/libs/model/cake_schema.php b/cake/libs/model/cake_schema.php index 42d865703..152d9cd33 100644 --- a/cake/libs/model/cake_schema.php +++ b/cake/libs/model/cake_schema.php @@ -485,11 +485,13 @@ class CakeSchema extends Object { if (isset($old[$table]['indexes']) && isset($new[$table]['indexes'])) { $diff = $this->_compareIndexes($new[$table]['indexes'], $old[$table]['indexes']); - if ($diff && isset($diff['drop'])) { - $tables[$table]['drop']['indexes'] = $diff['drop']; - } - if ($diff && isset($diff['add'])) { - $tables[$table]['add']['indexes'] = $diff['add']; + if ($diff) { + if (isset($tables[$table]['drop']['indexes']) && isset($diff['drop'])) { + $tables[$table]['drop']['indexes'] = $diff['drop']; + } + if (isset($tables[$table]['add']['indexes']) && isset($diff['add'])) { + $tables[$table]['add']['indexes'] = $diff['add']; + } } } if (isset($old[$table]['tableParameters']) && isset($new[$table]['tableParameters'])) { diff --git a/cake/tests/cases/libs/model/model_validation.test.php b/cake/tests/cases/libs/model/model_validation.test.php index c70f6a1bf..80dc78589 100644 --- a/cake/tests/cases/libs/model/model_validation.test.php +++ b/cake/tests/cases/libs/model/model_validation.test.php @@ -69,6 +69,56 @@ class ModelValidationTest extends BaseModelTest { ); $this->assertEqual($TestModel->invalidFields(), $expected); + + $TestModel->validate['title'] = array( + 'rule' => array('customValidatorWithSixParams', 'one', 'two', null, 'four'), + 'required' => true + ); + $TestModel->create(array('title' => 'foo')); + $TestModel->invalidFields(); + $expected = array( + 'data' => array( + 'title' => 'foo' + ), + 'one' => 'one', + 'two' => 'two', + 'three' => null, + 'four' => 'four', + 'five' => array( + 'rule' => array(1 => 'one', 2 => 'two', 3 => null, 4 => 'four'), + 'on' => null, + 'last' => false, + 'allowEmpty' => false, + 'required' => true + ), + 'six' => 6 + ); + $this->assertEqual($TestModel->validatorParams, $expected); + + $TestModel->validate['title'] = array( + 'rule' => array('customValidatorWithSixParams', 'one', array('two'), null, 'four', array('five' => 5)), + 'required' => true + ); + $TestModel->create(array('title' => 'foo')); + $TestModel->invalidFields(); + $expected = array( + 'data' => array( + 'title' => 'foo' + ), + 'one' => 'one', + 'two' => array('two'), + 'three' => null, + 'four' => 'four', + 'five' => array('five' => 5), + 'six' => array( + 'rule' => array(1 => 'one', 2 => array('two'), 3 => null, 4 => 'four', 5 => array('five' => 5)), + 'on' => null, + 'last' => false, + 'allowEmpty' => false, + 'required' => true + ) + ); + $this->assertEqual($TestModel->validatorParams, $expected); } /** diff --git a/cake/tests/cases/libs/model/models.php b/cake/tests/cases/libs/model/models.php index ac89baf7a..516544796 100644 --- a/cake/tests/cases/libs/model/models.php +++ b/cake/tests/cases/libs/model/models.php @@ -2218,6 +2218,16 @@ class ValidationTest1 extends CakeTestModel { function customValidatorWithMessage($data) { return 'This field will *never* validate! Muhahaha!'; } +/** + * Test validation with many parameters + * + * @return void + */ + function customValidatorWithSixParams($data, $one = 1, $two = 2, $three = 3, $four = 4, $five = 5, $six = 6) { + $this->validatorParams = get_defined_vars(); + unset($this->validatorParams['this']); + return true; + } } /**