Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation appears to need some love #233

Open
kirkbushell opened this issue Nov 7, 2024 · 3 comments
Open

Documentation appears to need some love #233

kirkbushell opened this issue Nov 7, 2024 · 3 comments

Comments

@kirkbushell
Copy link

I've come across a number of inconsistencies between docs and code, resulting in code diving to understand exactly what is going on... Just wondering if maybe I've missed something, or the docs need to be published/deployed?

Additionally, there's no guidance on how to work with aggregate snapshotting when dealing with child aggregates.

@frankdejonge
Copy link
Member

First off, hi Kirk :) hope you're doing well.

I've come across a number of inconsistencies between docs and code, resulting in code diving to understand exactly what is going on... Just wondering if maybe I've missed something, or the docs need to be published/deployed?

The docs are continuously deployed. If you could perhaps elaborate what inconsistencies you've encountered, that would help to get them addressed. Your issue doesn't list any and I don't think trying to scan through to spot them is an efficient approach.

As for the snapshotting with child aggregates; From what I can see all the building-blocks seem to be there. The reconstitution from the state is in the docs, as is the registering of child entities. I'm not sure what you're missing from the docs, perhaps you could elaborate.

@kirkbushell
Copy link
Author

kirkbushell commented Nov 7, 2024

@frankdejonge Hurro :) Likewise - been a while! hehe

Yeah I can provide some examples, no problem there - I just thought maybe I was working with the wrong docs, somehow so I wanted to clarify that first.

Regarding snapshotting, I worked it out. What I did is just add a method to the child aggregate for reconstituting from a snapshot. Nothing more is required of the library, it's just a bit of manual lifting.

I think just adding a few pointers in the docs makes it clear. I was expecting something to be provided by the library to do that automatically, before realising it was on me to solve. See below:

protected static function reconstituteFromSnapshotState(AggregateRootId $id, mixed $state): AggregateRootWithSnapshotting
{
    $aggregate = new static($id);
    $aggregate->resource = Resource::from($state['resource']);
    $aggregate->formId = new FormId($state['formId']);
    $aggregate->resourceId = new ResourceId($state['resourceId']);
    $aggregate->bootChildAggregate();
    $aggregate->childAggregate->reconstituteFromSnapshotState($state['childData']);

    return $aggregate;
}

So it's very easy to do and support, I just had to take a step back to realise that the library doesn't do that for you - unless I missed something?

I'll setup a PR to resolve the disparities I found in the docs :)

@kirkbushell
Copy link
Author

PS - what's happening with the laravel library? I've put my hand up to help maintain that. We were going to use it but found that it required some love, but happy to work on it and help out as required, as we implement DDD in our own software.

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

No branches or pull requests

2 participants