You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Validator prevents saving stating that field has changed. The reason is that comparison is done with ===, however for objects it should be somewhat different. And for DbRefs should only compare if it is same document
Expected:
Because DbRef points to same object, it should allow saving even if object is different
Offending code in Maslosoft\Mangan\Validators\BuiltIn\ImmutableValidator:
...// Not stored in DBif (empty($found->$against))
{
returntrue;
}
// Stored in DB, but value is sameif ($found->$attribute === $model->$attribute) // <<< HERE
{
returntrue;
}
$label = ManganMeta::create($model)->field($attribute)->label;
$this->addError('msgImmutable', ['{attribute}' => $label, '{value}' => $value]);
returnfalse;
...
The text was updated successfully, but these errors were encountered:
Scenario:
Current:
===
, however for objects it should be somewhat different. And for DbRefs should only compare if it is same documentExpected:
Offending code in
Maslosoft\Mangan\Validators\BuiltIn\ImmutableValidator
:The text was updated successfully, but these errors were encountered: