Nested object's method rules
is ignored when parent object is validated
#134
Answered
by
rubenvanassche
alexrififi
asked this question in
Q&A
-
Structure like this: class ArtistData extends Data
{
public function __construct(
public string $name,
public int $age,
) {
}
}
class AlbumData extends Data
{
public function __construct(
public string $title,
public ArtistData $artist,
) {
}
} When validating an |
Beta Was this translation helpful? Give feedback.
Answered by
rubenvanassche
Jun 3, 2022
Replies: 1 comment 1 reply
-
Hi @medvinator, Could you provide me a test which shows where this is going wrong? We have a test for nested data objects with overwritten rules : https://github.com/spatie/laravel-data/blob/main/tests/Resolvers/DataValidationRulesResolverTest.php#L74-L90 and it seems to be working fine to me. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
alexrififi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @medvinator,
Could you provide me a test which shows where this is going wrong? We have a test for nested data objects with overwritten rules : https://github.com/spatie/laravel-data/blob/main/tests/Resolvers/DataValidationRulesResolverTest.php#L74-L90 and it seems to be working fine to me.