Open dereuromark opened 5 years ago
$carsArray = $carsDto->toArray();
I don't think we can rule out cases when Cars
might have more than one field: a collection of Car
and some other field, like type
(van, sedan, etc) which describes the collection in some semantic way.
But it would make it probably a bit confusing and more complex on the dto internal side. Maybe a different key is necessary then?
I do agree though that it makes sense to introduce a new collection tag when we just want a single collection object of Car
without any other fields. IMO this would generally improve QoL.
So the generated code would be a subtype of Dto with specific methods.
The class would be NameCollection
(with Collection suffix instead of Dto), correct?
Also, here then singular is also possible? For add...()
sugar methods etc?
Do we want dtos as collections directly?
instead of
it could directly be
and must not have any fields/children then.
Instead of
one could do
It would also be a bit more intuitive for options array vs Options dto etc, directly being collections some of them have a very similar meaning to collection objects (ArrayObject collections etc) as they already exist in the apps.
But it would make it probably a bit confusing and more complex on the dto internal side. Maybe a different key is necessary then?
This might also go into a similar direction as https://github.com/burzum/cakephp-config-objects And it should definitely work with "associative" true/false.