I am using validation in my models and want to be specific about the validation errors. I want to know from which class and property and error came. I am aware that it is possible by setting the 'defaultPropertyPath' to something like 'Address.street', but this will cause a lot of duplication. For each 'that' call you'd have to specify the property.
What I am looking for is an API which looks more like this:
For the "root" it might also be a nice idea to add a 'getRootPath' function that can be overriden. So that someone can pass in $this or $something::class and then format it inside this function, for example: reading $this::class and stripping it down to the basename.
I already have an implementation for this. Of course, to be backwards compatible it would mean that the that function can not be used; so maybe a new function called thatProperty.
I am using validation in my models and want to be specific about the validation errors. I want to know from which class and property and error came. I am aware that it is possible by setting the 'defaultPropertyPath' to something like 'Address.street', but this will cause a lot of duplication. For each 'that' call you'd have to specify the property.
What I am looking for is an API which looks more like this:
For the "root" it might also be a nice idea to add a 'getRootPath' function that can be overriden. So that someone can pass in
$this
or$something::class
and then format it inside this function, for example: reading$this::class
and stripping it down to the basename.I already have an implementation for this. Of course, to be backwards compatible it would mean that the
that
function can not be used; so maybe a new function calledthatProperty
.