-
Notifications
You must be signed in to change notification settings - Fork 41
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
use custom aggregate type mapping #65
Conversation
docs/repositories.md
Outdated
'aggregate_repository' => [ | ||
'user_repository' => [ //<-- here the container id is referenced | ||
'repository_class' => MyUserRepository::class, | ||
'aggregate_type' => 'user', //<-- The custom aggregate type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would be nice:
'aggregate_type' => ['user' => MyUserClass],
With AggregateType::fromArray(['user' => MyUserClass]) and
$aggregateType->mappedClass()`
But I'm not sure if this is a BC break.
Or maybe AggregateType::fromString|fromAggregate|fromAggregateRootClass('user', ['user' => MyUserClass, 'todo' => MyTodoClass])
You have a global aggregateTypeMap and you can pass it (new optional arg) to the AggregateType value object so that mapping is done insight the VO.
Just some thoughts for improvements because repo construct takes already a lot of optional args
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I will check what's possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, thx
updated |
docs/repositories.md
Outdated
## Aggregate Type Mapping | ||
|
||
It's possible to map an aggregate type `user` to an aggregate root class like `My\Model\User`. To do that, add the | ||
aggregate type mapping to your repository and use the provided aggregate type. The aggregate type mapping is the last |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
text needs update ;)
Minor issue regarding docs but LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beside fromString still being here LGTM
} | ||
|
||
/** | ||
* Use this factory when the aggregate type is not equal to the aggregate root class | ||
* | ||
* @throws Exception\InvalidArgumentException | ||
*/ | ||
public static function fromString(string $aggregateTypeString): AggregateType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need this method now we go for fromMapping
Actually we don't, but removing would be BC.
…On Jun 21, 2017 3:00 AM, "Bas Kamer" ***@***.***> wrote:
***@***.**** commented on this pull request.
beside fromString still being here LGTM
------------------------------
In src/Aggregate/AggregateType.php
<#65 (comment)>:
> }
/**
* Use this factory when the aggregate type is not equal to the aggregate root class
+ *
+ * @throws Exception\InvalidArgumentException
*/
public static function fromString(string $aggregateTypeString): AggregateType
do we still need this method now we go for fromMapping
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#65 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAYEvA2NmXmDzKr2YTFkOIb68POWtntRks5sGBbqgaJpZM4N_UVX>
.
|
kk |
resolves #64