Failures collection format #3825
quantumwebco
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
I think it would be fine to make row a public property, anything else would be a breaking change. Adding a convenience method for this would be fine too. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The failures collection is formatted in an odd way
If there is, for example, an email and an age column and the rules are valid email and age > 0, the errors don't come together like
Currently they all come separately, with an item for each attribute that errored and grouped by the validation. So I get a list of all the rows that failed email validation, then a list of all the rows that failed age validation. Which means rows that failed on more than one rule are duplicated just with a different error message and not grouped together
Can kind of get around it by
groupBy(fn($item) => $item->row())
which would be nicer if row wasn't a protected property so can just dogroupBy('row')
, and then manipulating and flattening etc.Do I just have a weird use case or would others also prefer the collection formatted as above?
Beta Was this translation helpful? Give feedback.
All reactions