Skip to content

Releases: dereuromark/cakephp-dto

1.5.2

09 Dec 14:59
917f554
Compare
Choose a tag to compare

Fixes

Full Changelog: 1.5.1...1.5.2

1.5.1

14 Nov 12:16
c3c86f8
Compare
Choose a tag to compare

Improvements

  • Allow digits in DTO names
  • Relax file names for DTO configs

1.5.0

15 Dec 22:07
fea80ec
Compare
Choose a tag to compare

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.

1.4.0

07 Dec 11:33
Compare
Choose a tag to compare

Improvements

Allow custom DTO specification file finder class to be configured - using Configure key 'CakeDto.finder'. Thx to @jorisvaesen for this contribution.

1.3.0

29 Nov 16:46
81c0358
Compare
Choose a tag to compare

Improvements

  • Added set*OrFail() wrapper to make it easier to have an early error system for invalid null setting.

CakePHP 4.3 checked/approved and CakePHP 4.2+ / PHP 7.3+ now.

1.2.4

18 Oct 15:10
ab0d07f
Compare
Choose a tag to compare

Fixes

  • Uses configured App namespace by default

1.2.3

16 Oct 13:44
cf24eca
Compare
Choose a tag to compare

Improvements

Stricter validation for collection type: type[] instead of type required

1.2.2

08 Oct 18:04
841d583
Compare
Choose a tag to compare

Fixes

Adjusted to allow for latest PHPStan strict rules.

1.2.1

02 Sep 14:45
Compare
Choose a tag to compare

Fixes

Small fix in builder.

1.2.0

02 Dec 12:55
Compare
Choose a tag to compare

Improvements

Stricter validation for field names and types.

  • If a field name is not camelBacked
  • If setting through fromArray() contains not matching scalar types for immutable or any type for mutable objects

Default value object instantiation has been improved.
factory XML attribute added in case the default constructor option is not sufficient for some edge cases.
The following should work out of the box for also string input (e.g. from API data):

<field name="created" type="\Cake\I18n\FrozenTime"/>

BC breaking impact

The config scalarTypeHints has been renamed to scalarAndReturnTypes since this is closer to what it stands for.
Since it defaults to true either way, this is a small BC break early in the 1.x release.

Please make sure you regenerate all DTOs after this upgrade!