Skip to content

Commit

Permalink
2.12 changelog & DTO hydration docs tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverryan committed Sep 22, 2023
1 parent db0b769 commit aa04c5f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
7 changes: 6 additions & 1 deletion src/LiveComponent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

## 2.12.0

- Add `onUpdated` hook for `LiveProp`
- Add support for (de)hydrating DTO classes in `LiveProp`.
- Fixed `emit()` method of `TestLiveComponent` to properly test events.
- Add `actionAs()` to `TestLiveComponent`.
- Fixed rendering bug when using Chrome's translation feature.
- Add `onUpdated()` hook for `LiveProp`.
- Fix support for Alpine.js & live components.

## 2.11.0

Expand Down
16 changes: 9 additions & 7 deletions src/LiveComponent/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -625,9 +625,9 @@ persisted entities, which dehydrate to an ``id``).
Using DTO's on a LiveProp
~~~~~~~~~~~~~~~~~~~~~~~~~

.. versionadded:: 2.11
.. versionadded:: 2.12

The automatic (de)hydration of DTO objects was introduced in LiveComponents 2.11.
The automatic (de)hydration of DTO objects was introduced in LiveComponents 2.12.

You can also use a DTO (i.e. data transfer object / any simple class) with LiveProp as long as the property has the correct type::

Expand All @@ -648,13 +648,15 @@ To work with a collection of DTOs, specify the collection type inside PHPDoc::

Here is how the (de)hydration of DTO objects works:

- It finds all properties on your DTO that are readable and writable and dehydrates each one.
- the PropertyAccess component is used, which means getter and setter methods are supported, in addition to public properties.
- All "properties" (public properties or fake properties via
getter/setter methods) are read & dehydrated. If a property is settable
but not gettable (or vice versa), an error will be thrown.
- The PropertyAccess component is used to get/set the value, which means
getter and setter methods are supported, in addition to public properties.
- The DTO cannot have any constructor arguments.

If this solution doesn't feat your need

there are two others options to make this work:
If this solution doesn't fit your need there are two others options to
make this work:

Hydrating with the Serializer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 4 additions & 0 deletions src/TogglePassword/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 2.12.0

- Added default values for the Stimulus controller values.

## 2.11.0

- Introduce component!
6 changes: 6 additions & 0 deletions src/TwigComponent/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## 2.12.0

- Added a `debug:twig-component` command.
- Fixed bad exception when the error comes from a Twig template.
- Fixed deprecation with `TemplateCacheWarmer` return type.

## 2.11.0

- Support ...spread operator with html syntax (requires Twig 3.7.0 or higher)
Expand Down

0 comments on commit aa04c5f

Please sign in to comment.