Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I recently started migrating from spatie/data-transfer-object which I had enhanced quite a lot. Many parts I added can now be omitted, because they are already part of this package, which is very good.
But there are some areas in which I find this packages behaves very counter-intuitive.
One thing which that has cost me nerves is how the only function behaves:
only
in between, it will affect all other areas in the program which reference the same object.toArray()
on the parent, the only values of the nested objects are just ignored.Only
generally behaves very strange with nested objects. I appears that you have to list each nested property with dot notation, everything not explicitly listed will be ignored. You can not easily include a complete nested object with all its nested nested data when using only.I still have the feeling that I have a misunderstanding of how I am supposed to use this feature. So please explain in case I got something wrong!
For now I have implemented a workaround on my base data class, that I can use when transforming the data object to an array:
Beta Was this translation helpful? Give feedback.
All reactions