CakePHP DTO plugin - quickly generate useful data transfer objects for your app (mutable/immutable)
MIT License
Published by dereuromark 8 months ago
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>
Fixed up immutable DTOs for setter (withOrFail
instead of setOrFail
). Please make sure you are not using the former one.
Full Changelog: https://github.com/dereuromark/cakephp-dto/compare/2.1.0...2.2.0
Published by dereuromark 8 months ago
Added DTO schema generator from JSON schema or JSON example data
Navigate to
/admin/cake-dto/generate
locally in order to leverage it.
Also:
Published by dereuromark about 1 year ago
Enjoy DTOs in CakePHP apps the easy way: Minimal configuration, no manual coding needed.
Published by dereuromark about 1 year ago
Please test. Once this has been tested and approved, the stable release can be tagged.
Published by dereuromark about 1 year ago
Dto::TYPE_DEFAULT
by default which uses Dto::TYPE_CAMEL
)Published by dereuromark about 1 year ago
Foo/Bar
plugin.Published by dereuromark over 1 year ago
Dto
suffix to be configurable, or removed using empty string.Published by dereuromark almost 2 years ago
Full Changelog: https://github.com/dereuromark/cakephp-dto/compare/1.5.1...1.5.2
Published by dereuromark almost 2 years ago
Published by dereuromark almost 3 years ago
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.
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.
Published by dereuromark almost 3 years ago
Allow custom DTO specification file finder class to be configured - using Configure key 'CakeDto.finder'
. Thx to @jorisvaesen for this contribution.
Published by dereuromark almost 3 years ago
CakePHP 4.3 checked/approved and CakePHP 4.2+ / PHP 7.3+ now.
Published by dereuromark about 3 years ago
Published by dereuromark about 3 years ago
Stricter validation for collection type: type[]
instead of type
required
Published by dereuromark about 3 years ago
Adjusted to allow for latest PHPStan strict rules.
Published by dereuromark about 3 years ago
Small fix in builder.
Published by dereuromark almost 4 years ago
Stricter validation for field names and types.
camelBacked
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"/>
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!
Published by dereuromark about 4 years ago
scalarTypeHints
defaulting to true
now with PHP 7.2+?int[]
as (int|null)[]
Published by dereuromark over 4 years ago
This plugin will provide you with a tool to quickly generate custom and optimized DTOs for your special use cases.
They are close to Entity classes, but are not bound to the ORM and DB layer.