Skip to content

Commit

Permalink
Merge pull request #3036 from tigrang/bug-fix-validate
Browse files Browse the repository at this point in the history
Check `validate` option before validating
  • Loading branch information
markstory committed Mar 17, 2014
2 parents 2136783 + 6337937 commit 2ab9feb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/ORM/Table.php
Expand Up @@ -1125,7 +1125,7 @@ protected function _processSave($entity, $options) {
$associated = $options['associated'];
$options['associated'] = [];

if (!$this->validate($entity, $options)) {
if ($options['validate'] && !$this->validate($entity, $options)) {
return false;
}

Expand Down
10 changes: 1 addition & 9 deletions tests/TestCase/ORM/TableTest.php
Expand Up @@ -2778,15 +2778,7 @@ public function testSaveDeepAssociationOptions() {
->with($entity->author->supervisor, ['name' => 'Marc'])
->will($this->returnValue($entity->author->supervisor));

$options = new \ArrayObject([
'validate' => false,
'atomic' => false,
'associated' => []
]);
$supervisors->expects($this->once())
->method('validate')
->with($entity->author->supervisor, $options)
->will($this->returnValue(true));
$supervisors->expects($this->never())->method('validate');

$tags->expects($this->never())->method('_insert');

Expand Down

0 comments on commit 2ab9feb

Please sign in to comment.