Skip to content

Get a nested key as id while validating a nested array #1496

Answered by berrymore
berrymore asked this question in Q&A
Discussion options

You must be logged in to vote
// ...

try {
    v::allOf(
        v::keyNested('user.name', v::stringType()->length(1, 30))
    )->check($data);
} catch (ValidationException $e) {
    var_dump($e->getId()); // user.name
}

As a workaround, I use this solution

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@henriquemoody
Comment options

@berrymore
Comment options

@henriquemoody
Comment options

@henriquemoody
Comment options

Answer selected by henriquemoody
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants