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:
- 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
The Event, Command, Query and Deltatypes include a fromMetaDataKey property that allows you to define a Prooph metadata key to seed from
- name: ExampleEventtype: Eventchildren:
- name: ExampleEventAggregateIdtype: UuidpropertyName: idfromMetaDataKey: _aggregateIdDeltas 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.
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.
- name: OrganisationalUnitIdtype: Uuid
- name: OrganisationalUnitIdstype: SetmodelToEnforce: OrganisationalUnitIdDecorators 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
decorators:
- path: Funeralzone\FAS\Common\ValueObjects\Decorators\DecoratorOnehooks:
- type: constructormethod: methodToCallOnConstructOne
- path: Funeralzone\FAS\Common\ValueObjects\Decorators\DecoratorTwohooks:
- type: constructormethod: methodToCallOnConstructTwonamespace: ValueObjectsmodel:
# External models# ==========================
- name: EntityIdtype: Stringnamespace: Funeralzone\FAS\DomainEntitiestesting:
fromNative: "'1'"constructor: "'1'"# Data models# ==========================
- name: TenantIdtype: Uuid
- name: BereavedIdtype: Uuid
- name: ContactIdtype: Uuid
- name: DirectoryListingIdtype: Uuid
- name: MediaIdtype: Stringdecorators:
- path: Funeralzone\FAS\Common\ValueObjects\Decorators\MediaIdDecoratorTraithooks:
- type: constructormethod: decoratorConstruct
- name: MediaUploadRequestIdtype: String
- name: ProductIdtype: Uuid
- name: ServiceIdtype: Uuid
- name: StaffMemberIdtype: Uuid
- name: PackageIdtype: Uuid# Telephones# --------------------------
- name: TelephoneNumbertype: String
- name: TelephoneCountryCodetype: String
- name: Telephonetype: Telephone
- name: TelephoneTypetype: Enumvalues:
- WORK
- HOME
- MOBILE
- FAX# Address# --------------------------
- name: AddressLine1type: String
- name: AddressLine2type: String
- name: Towntype: String
- name: Countytype: String
- name: PostCodetype: String
- name: CountryCodetype: ISOAlpha2CountryCode
- name: GeoLocationtype: Compositechildren:
- name: AddressDatatype: StringpropertyName: data
- name: Geometrytype: CompositepropertyName: geometrychildren:
- name: Latitudetype: FloatpropertyName: latdecorators:
- path: Funeralzone\FAS\Common\ValueObjects\Decorators\LatitudeDecoratorTraithooks:
- type: constructormethod: decoratorConstructtesting:
fromNative: '50.9'constructor: '50.9'
- name: Longitudetype: FloatpropertyName: lngtesting:
fromNative: '50.9'constructor: '50.9'decorators:
- path: Funeralzone\FAS\Common\ValueObjects\Decorators\LongitudeDecoratorTraithooks:
- type: constructormethod: decoratorConstruct# Identity interface# --------------------------
- name: IdentityInterfacePolicyMembershiptype: String
- name: IdentityInterfacePolicyScopetype: String
- name: IdentityInterfacetype: Compositechildren:
- name: IdentityInterfaceTypetype: EnumpropertyName: typevalues:
- STAFF_MEMBER
- DEVELOPER
- name: IdentityInterfaceNametype: StringpropertyName: name
- name: IdentityInterfaceImagetype: StringpropertyName: image
- name: IdentityInterfaceEmailtype: EmailpropertyName: email
- name: IdentityInterfacePolicytype: CompositepropertyName: policychildren:
- name: IdentityInterfacePolicyMembershipstype: SetpropertyName: membershipsmodelToEnforce: IdentityInterfacePolicyMembership
- name: IdentityInterfacePolicyScopestype: SetpropertyName: scopesmodelToEnforce: IdentityInterfacePolicyScope# Other# --------------------------
- name: Notetype: Entitychildren:
- name: EntityIdpropertyName: id
- name: NoteTimeCreatedtype: RFC3339propertyName: timeCreated
- name: NoteContenttype: StringpropertyName: content
- name: NoteAuthorIdtype: UuidpropertyName: authorId
- name: Notestype: EntitySetmodelToEnforce: Note
- name: Nametype: Compositechildren:
- name: NameTitletype: StringpropertyName: title
- name: GivenNametype: StringpropertyName: givenName
- name: FamilyNametype: StringpropertyName: familyName
- name: PersonPhonetype: TelephoneContacttypeValues:
- WORK
- HOME
- MOBILE
- FAX
- name: PersonEmailtype: Email
- name: Persontype: Compositechildren:
- name: NamepropertyName: name
- name: PersonAddresstype: AddresspropertyName: address
- name: PersonPhonestype: SetpropertyName: phonesmodelToEnforce: PersonPhone
- name: PersonEmailstype: SetpropertyName: emailsmodelToEnforce: PersonEmail
- name: MediaIdpropertyName: image
- name: DirectoryListingIdstype: SetmodelToEnforce: DirectoryListingId
- name: OrganisationalUnitIdtype: Uuid
- name: OrganisationalUnitIdstype: SetmodelToEnforce: OrganisationalUnitId
- name: EstimateIdtype: Uuid
- name: EstimateIdstype: SetmodelToEnforce: EstimateId
- name: Tagtype: Stringdecorators:
- path: Funeralzone\FAS\Common\ValueObjects\Decorators\TagDecoratorTraithooks:
- type: constructormethod: decoratorConstruct
- name: Tagstype: Setdecorators:
- path: Funeralzone\FAS\Common\ValueObjects\Decorators\TagsDecoratorTraitmodelToEnforce: Tag
- name: PaginationInputtype: Compositechildren:
- name: PaginationInputPagetype: IntegerpropertyName: page
- name: PaginationInputNodesPerPagetype: IntegerpropertyName: nodesPerPage
- name: StaffRoleIdtype: Uuid
- name: StaffRoleIdstype: SetmodelToEnforce: StaffRoleId
- name: DeveloperIdtype: Uuid
- name: DeveloperIdstype: SetmodelToEnforce: DeveloperId
- name: PersonDeltatype: Deltachildren:
- name: NamepropertyName: name
- name: PersonAddresspropertyName: address
- name: PersonPhonespropertyName: phones
- name: PersonEmailspropertyName: emails
- name: MediaIdpropertyName: image