yiisoft / validator

Yii validator library
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
110 stars 36 forks source link

Add methods `getFirstErrorMessagesIndexedByAttribute()` and `getFirstErrorMessagesIndexedByPath()` to `Result` class #649

Closed vjik closed 2 months ago

arogachev commented 2 months ago

Should a single error be string or string within array (for structure to be consistent with similar methods)?

vjik commented 2 months ago

Should a single error be string or string within array (for structure to be consistent with similar methods)?

String only.

Example for getFirstErrorMessagesIndexedByAttribute():

[
  'name' => 'error...',
  'age' => 'error...',
]