Download the PHP package funeralzone/valueobject-generator without Composer
On this page you can find all versions of the php package funeralzone/valueobject-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download funeralzone/valueobject-generator
More information about funeralzone/valueobject-generator
Files in funeralzone/valueobject-generator
Package valueobject-generator
Short Description A generator for immutable Value Objects
License
Informations about the package valueobject-generator
Value object generator
Upgrade notes for V0 to V1
Everything is a model
There is no longer a strong bias toward Event Sourcing so the concept of events, commands, queries and deltas has been removed and the onus of implementing these placed on the types/template library.
The practical upshots of this change are as follows:
events, commands, queries and deltas
- Top level items for events, commands, queries and deltas have been removed; every model lives under the model top-level item
- When creating events, commands, queries and deltas there is no deltas property; use must define children models that happen to implement delta behaviour
- events, commands, queries and deltas are now dedicated types - Event, Command, Query and Delta respectively
Seeding models from Prooph meta data
The Event, Command, Query and Delta types include a fromMetaDataKey property that allows you to define a Prooph metadata key to seed from
Deltas seeded with the root payload
Deltas can no longer automatically receive the root payload of a command/event.
In V0 you could optionally supply a useRootData flag in the definition which meant the delta received the entire payload of the event or command rather than just its specific property. This is no longer possible.
In order to re-create this behaviour you can bundle up the necessary properties within the Prooph resolver and add a fabricated array property to the command/events payload.
Sets no longer accept child models
In V0 sets would require a single child model which inferred the type of contents the Set would accept. This is no longer possible.
In V1 you must explicitly define the type of model a Set can contain by setting the modelToEnforce property. This property must reference a valid model.
Decorators
Decorators have had a overhaul:
- you can now have multiple decorators per model
- you do not define their target, i.e. the nullDecorator, nonNUllDecorator and nullableDecerator properties are defunct
- they are hook based, allowing decorators to be tied into different actions within a model
Available hooks:
- constructor - executes during the constructor of a model and receives all arguments used to instantiate the object
Example definition
All versions of valueobject-generator with dependencies
symfony/yaml Version 3.*
twig/twig Version 2.4.*
prettus/laravel-validation Version 1.1.*
funeralzone/valueobjects Version 0.4.*