Releases: dereuromark/cakephp-dto
2.2.1
2.2.0
Improvements
Added Enum support, mainly int/string backed enums are now handled gracefully.
Example:
<dto name="FooBar" immutable="true">
...
<field name="someUnit" type="\App\Model\Enum\MyUnit"/>
<field name="someStringBacked" type="\App\Model\Enum\MyStringBacked"/>
<field name="someIntBacked" type="\App\Model\Enum\MyIntBacked"/>
</dto>
Fixes
Fixed up immutable DTOs for setter (withOrFail
instead of setOrFail
). Please make sure you are not using the former one.
Full Changelog: 2.1.0...2.2.0
2.1.0
Improvements
Added DTO schema generator from JSON schema or JSON example data
Navigate to
/admin/cake-dto/generate
locally in order to leverage it.
Also:
- Collision avoidance for singular of collections when that field is already present in the DTO. One must set a different one then to be able to use the collection item methods.
- Multiple depths of namespace is now supported.
For a live demo see https://sandbox.dereuromark.de/sandbox/dto-examples/generator
2.0.0
CakePHP 5 compatible release
Enjoy DTOs in CakePHP apps the easy way: Minimal configuration, no manual coding needed.
1.8.0
Improvements
- Allow global key type config (
Dto::TYPE_DEFAULT
by default which usesDto::TYPE_CAMEL
)
1.7.0
Fixes
- Fixed generation for namespaced plugin names, e.g.
Foo/Bar
plugin.
Improvements
- Extending from any DTO compatible class is now possible.
1.6.0
Improvements
- Allow
Dto
suffix to be configurable, or removed using empty string. - PHP 7.4+ now.
1.5.2
Fixes
- Allow int as float type fix for immutables by @jorisvaesen in #59
- Fixed empty arrayobject to array by @jorisvaesen in #60
Full Changelog: 1.5.1...1.5.2
1.5.1
Improvements
- Allow digits in DTO names
- Relax file names for DTO configs
1.5.0
Fixes
Serializable
Implementing Serializable interface is deprecated in PHP 8.1 without having the magic methods in place.
Those have now been added. They return associative arrays however and work differently than the explicit serialize()
call which returns a string.
Collections
Fixed duplication issue with using collections and name collisions in certain aliasing cases.
Note: This can be BC impacting if you use aliasing here, double-check this before upgrading
Example
<field name="labels" type="FilterElement[]"/>
<field name="brands" type="FilterElement[]"/>
Before, this was creating methods using the singular "FilterElement" instead of "Label" or "Brand".
This is now fixed.