Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
set correct default validate option, now matches saveAll/saveMany def…
…ault value, fixes #2492
  • Loading branch information
ceeram committed Jan 20, 2012
1 parent a70c8c7 commit d4e2fbf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/Cake/Model/Model.php
Expand Up @@ -2018,8 +2018,8 @@ public function validateMany($data, $options = array()) {
*
* #### Options
*
* - `validate` Set to false to disable validation, true to validate each record before saving,
* 'first' to validate *all* records before any are saved. Defaults to `true`.
* - `validate` Set to `false` to disable validation, `true` to validate each record before saving,
* 'first' to validate *all* records before any are saved(default),
* - `atomic` If true (default), will attempt to save all records in a single transaction.
* Should be set to false if database/table does not support transactions.
* - `fieldList` Equivalent to the $fieldList parameter in Model::save()
Expand All @@ -2036,7 +2036,7 @@ public function saveAssociated($data = null, $options = array()) {
$data = $this->data;
}

$options = array_merge(array('validate' => true, 'atomic' => true), $options);
$options = array_merge(array('validate' => 'first', 'atomic' => true), $options);
$this->validationErrors = $validationErrors = array();

if (empty($data) && $options['validate'] !== false) {
Expand Down
3 changes: 1 addition & 2 deletions lib/Cake/Test/Case/Model/ModelWriteTest.php
Expand Up @@ -4260,8 +4260,7 @@ public function testSaveAssociatedHasOneValidation() {
'user_id' => 1
),
'Attachment' => array('attachment' => '')
),
array('validate' => 'first')
)
), false);
$expected = array(
'Comment' => array('comment' => array('This field cannot be left blank')),
Expand Down

0 comments on commit d4e2fbf

Please sign in to comment.