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

Internal IDs are not internal #4

Open
EverCodeAP opened this issue Feb 12, 2018 · 0 comments
Open

Internal IDs are not internal #4

EverCodeAP opened this issue Feb 12, 2018 · 0 comments

Comments

@EverCodeAP
Copy link

Let's take Route entity for example. It has something called internalIdentity and yet it is used in application layer, infrastructure layer and domain layer.
If Route is an Entity then it should have an identity. It wouldn't be internal I think and it shouldn't be named as such.
If it's really internal and used solely for the purpose of persistence, then it shouldn't be leaking to other layers at all.
I know that using ORM with DDD is a pain and it is acceptable (or rather unavoidable) to lose some of the domain purity for the sake of saving things, but such a technical ID should sit quietly and wait to be used for persistence, not for relations in your domain.

Also, is Leg really an Entity here? I mean from domain point of view, not from data-relations point of view. If you drop DB and think in-memory only, would your app behave any different if you got rid of internalIdentity from Leg? You are already comparing legs through dates, so it's a perfect candidate to be a value object. It may be persisted in separate table and have a technical ID, but that does not make it automatically an entity in domain layer.

Great project though, and I realize it passed 4 years since the last commit, so you probably would have done things a little different now, when Doctrine supports value objects, so this issue is more like information for those who are coming here now, as did I :)

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

No branches or pull requests

1 participant