Applied patch by 'preloader', closes #4561

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6937 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
the_undefined 2008-05-19 02:31:26 +00:00
parent abe853a978
commit 71790792d0
2 changed files with 10 additions and 3 deletions

View file

@ -1419,7 +1419,11 @@ class Model extends Overloadable {
}
}
}
$this->validationErrors = $validationErrors;
if (isset($validationErrors[$this->alias])) {
$this->validationErrors = $validationErrors[$this->alias];
}
switch (true) {
case ($options['validate'] === 'only'):

View file

@ -2222,7 +2222,8 @@ class ModelTest extends CakeTestCase {
'Comment' => array('comment' => 'This field cannot be left blank'),
'Attachment' => array('attachment' => 'This field cannot be left blank')
);
$this->assertEqual($model->validationErrors, $expected);
$this->assertEqual($model->validationErrors, $expected['Comment']);
$this->assertEqual($model->Attachment->validationErrors, $expected['Attachment']);
$this->assertFalse($model->saveAll(
array(
@ -2231,7 +2232,8 @@ class ModelTest extends CakeTestCase {
),
array('validate' => 'only')
));
$this->assertEqual($model->validationErrors, $expected);
$this->assertEqual($model->validationErrors, $expected['Comment']);
$this->assertEqual($model->Attachment->validationErrors, $expected['Attachment']);
}
function testSaveAllAtomic() {
@ -2498,7 +2500,8 @@ class ModelTest extends CakeTestCase {
$result = $model->find('all');
$this->assertEqual($result, array());
$expected = array('Comment' => array(0 => array('comment' => 'This field cannot be left blank')));
$this->assertEqual($model->validationErrors, $expected);
$this->assertEqual($model->Comment->validationErrors, $expected['Comment']);
$this->assertIdentical($model->Comment->find('count'), 0);