Replies: 1 comment 1 reply
-
The purpose of this is that we want to pass values to internal properties that cannot be faked by the outside or do not need to create a new class to declare additional properties that need to be protected by external users, easily use $dto->toArray without having to redefine the toArray function when declaring protected/private properties. I tested it and it worked. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone, I checked the #[Hidden] property and I saw that only when using $dto->toArray(), the array only hides that column, but the validation and property value are still set if I use $dto->property_name or or tampered input field. I created a class called Internal and modified the code in the core, this class is similar to Optional but the difference is that when hinting the Internal type into the property like public Internal|string $transaction_type, even if the user forges the input and passes data up, it will never validate and assign values to them. Only when I use DTO::from([...]) if I enable ValidationStrategy->Always will it validate that Internal property or DTO::validateAndCreate([...]), [...] is array
Beta Was this translation helpful? Give feedback.
All reactions