@@ -242,7 +242,7 @@ LiveProp Data Types
242242
243243LiveProps must be a value that can be sent to JavaScript. Supported values
244244are scalars (int, float, string, bool, null), arrays (of scalar values), enums,
245- DateTime objects & Doctrine entity objects.
245+ DateTime objects, Doctrine entity objects, DTO, or array of DTO .
246246
247247See :ref: `hydration ` for handling more complex data.
248248
@@ -625,10 +625,33 @@ persisted entities, which dehydrate to an ``id``).
625625Hydration, DTO's & the Serializer
626626~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
627627
628- If you try to use a ``LiveProp `` for some unsupported type (e.g.a DTO object),
629- it will fail. A best practice is to use simple data.
628+ .. versionadded :: 2.11
629+
630+ Dto are now a supported type for LiveComponent
631+
632+ To use a ``LiveProp `` with DTO simply type properly your property
633+
634+ .. code-block :: php
635+
636+ class ComponentWithAddressDto
637+ {
638+ public AddressDto $addressDto;
639+ }
640+
641+ And to work with DTO collection, you simply need to specified the collection type in your phpdoc
642+
643+ .. code-block :: php
644+
645+ class ComponentWithAddressDto
646+ {
647+ /**
648+ * @var AddressDto[]
649+ /*
650+ public array $addressDtoCollection;
651+ }
630652
631- But there are two options to make this work:
653+ If this solution doesn't feat your need
654+ there are two others options to make this work:
632655
6336561) Hydrating with the Serializer
634657................................
0 commit comments