Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

Add a create method to aggregate roots #142

Closed
sebastiandedeyne opened this issue Apr 11, 2019 · 3 comments
Closed

Add a create method to aggregate roots #142

sebastiandedeyne opened this issue Apr 11, 2019 · 3 comments

Comments

@sebastiandedeyne
Copy link
Member

When you want to "start" a new aggregate root, you know need to generate a uuid, and "retrieve" an aggregate root with that uuid. In many cases, you know the aggregate root doesn't exist yet (e.g. when a user registers themself).

I propose an AggregateRoot::create() method which will generate a new uuid internally.

@freekmurze
Copy link
Member

How about naming it start? AggregateRoot::start()

@adrianb93
Copy link
Contributor

I have been using ordered uuids in my projects. It would be nice if LEP could allow the configuration of how the UUID is generated for this feature.

@freekmurze
Copy link
Member

freekmurze commented Apr 13, 2019

In order to keep the package light, I've decided against adding this feature.

I'm thinking it's the responsibility of the user to generate the uuid to use. I can image that, for cases where you immediately want to return a result when creating a model, you want to have knowledge of the uuid used.

https://github.com/spatie/larabank-event-projector/blob/master/app/Account.php#L15-L30

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants