Skip to content

Commit ae438e7

Browse files
authored
Merge pull request #170 from lorro/patch-1
Added model alias to validation methods
2 parents 0155756 + dcfcc47 commit ae438e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Model/Behavior/PasswordableBehavior.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ public function validateNotSameHash($data, $context) {
416416
$primaryKey = $context['data'][$this->_table->primaryKey()];
417417
$value = $context['data'][$context['field']];
418418

419-
$dbValue = $this->_table->find()->where([$this->_table->primaryKey() => $primaryKey])->first();
419+
$dbValue = $this->_table->find()->where([$this->_table->alias() . '.' . $this->_table->primaryKey() => $primaryKey])->first();
420420
if (!$dbValue) {
421421
return true;
422422
}
@@ -440,7 +440,7 @@ protected function _validateSameHash($pwd, $context) {
440440
$field = $this->_config['field'];
441441

442442
$primaryKey = $context['data'][$this->_table->primaryKey()];
443-
$dbValue = $this->_table->find()->where([$this->_table->primaryKey() => $primaryKey])->first();
443+
$dbValue = $this->_table->find()->where([$this->_table->alias() . '.' . $this->_table->primaryKey() => $primaryKey])->first();
444444
if (!$dbValue) {
445445
return false;
446446
}

0 commit comments

Comments
 (0)