-
-
Notifications
You must be signed in to change notification settings - Fork 492
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
feat(value-objects) - Add value objects to mikro-orm #5000
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #5000 +/- ##
==========================================
- Coverage 99.66% 99.64% -0.03%
==========================================
Files 221 225 +4
Lines 16204 16291 +87
Branches 3890 3909 +19
==========================================
+ Hits 16150 16233 +83
- Misses 54 56 +2
- Partials 0 2 +2 ☔ View full report in Codecov by Sentry. |
How is this different from embeddables (or custom types if it's about a single column, you can use those to validate the values too)? I don't think we need anything else for value objects. If something, we could improve the support for those two existing features, I don't want to add something "almost the same", it would only make things more confusing. |
@B4nan
At the moment I thought about these two points, but I believe there could be more. |
In this pull request, we add Value Objects to our project. Value Objects are a software design practice that allows us to encapsulate values with specific behaviors and business rules in immutable objects.
The addition of these Value Objects brings several advantages to our project:
1.Encapsulation: Each Value Object encapsulates validation logic and behavior related to the value it represents. This makes our code more modular and easier to maintain.
2. Immutability: Value Objects are immutable, which means that once created, their values cannot be changed.
This helps prevent bugs and makes our code more predictable.
3. Re-usability: Value Objects can be reused in different parts of our code, which helps reduce code duplication.
Utilization
Example of Value-Object