Skip to content
Permalink
Browse files

Don't pass validaiton preferences down to associations in Table::save()

Fixes #3873
  • Loading branch information...
lorenzo committed Jul 5, 2014
1 parent 9b20a21 commit 7ad59c9ee3fdd253a6aa4d7ab633245ab1817462
Showing with 4 additions and 3 deletions.
  1. +3 −2 src/ORM/Table.php
  2. +1 −1 tests/TestCase/ORM/TableTest.php
@@ -1136,8 +1136,9 @@ protected function _processSave($entity, $options) {
$associated = $options['associated'];
$options['associated'] = [];
$validate = $options['validate'];
if ($options['validate'] && !$this->validate($entity, $options)) {
if ($validate && !$this->validate($entity, $options)) {
return false;
}
@@ -1153,7 +1154,7 @@ protected function _processSave($entity, $options) {
$this,
$entity,
$options['associated'],
$options->getArrayCopy()
['validate' => (bool)$validate] + $options->getArrayCopy()
);
if (!$saved && $options['atomic']) {
@@ -2106,7 +2106,7 @@ public function testSaveWithDifferentValidatorAndAssociations() {
$this->assertFalse($table->save($entity, ['validate' => 'custom']));
$this->assertNotEmpty($entity->author->errors('thing'));
$this->assertSame($entity, $table->save($entity), 'default was not used');
$this->assertFalse($table->save($entity), 'default was not used');
}
/**

0 comments on commit 7ad59c9

Please sign in to comment.
You can’t perform that action at this time.