cphalcon
cphalcon copied to clipboard
Phalcon\Mvc\Model::hasChanged($fieldName) does not work on before object is saved to db in 1.3.0
Phalcon\Mvc\Model::hasChanged($fieldName) does not work on before object is saved to db
$user = new User()
$user->save(); //error Model does not have a valid snapshot data
//validate method
public static function validation()
{
if ($this->hasChanged('password')) {
$this->validate(new StringLengthValidator(array(
'field' => 'password',
'max' => 30,
'min' => 6
)));
}
}
hasChanged should return true for new objects
+1
@sergeyklay Can we close this?