value-objects

Domain Objects and Value Objects - are they equal?

余生长醉 提交于 2019-12-21 12:19:06
问题 By looking to the example of a Domain Object into Zend Quickstart tutorial, and other examples considering a DAO/VO patterns, they both seem to be very similar. Can we deduce that to say "Value Object" is the same as to say "Domain Object" ? If not, can you please clarify the differences between those? What is the function of one, and what if the function of another ? I'm asking this because, both are composed by getters and setters and nothing more then that. It seems that, they do the same

How value objects are saved and loaded?

一笑奈何 提交于 2019-12-18 10:56:18
问题 Since there aren no respositories for value objects. How can I load all value objects? Suppose we are modeling a blog application and we have this classes: Post (Entity) Comment (Value object) Tag (Value object) PostsRespository (Respository) I Know that when I save a new post, its tags are saved with it in the same table. But how could I load all tags of all posts. Should PostsRespository have a method to load all tags? I usually do it, but I want to know others opinions 回答1: I'm looking for

DDD, value objects and ORM

Deadly 提交于 2019-12-18 00:42:53
问题 Value objects do not have identity. ORM needs identity to update the database. How to trick ORM? (Marking Id for value object as internal won't work because ORM lives in a different assembly and moving it to the same assembly is not acceptable). Thanks in advance. 回答1: As far as my understanding of DDD goes value objects are just a way to partition your entities. If a value object should be stored with an ID in the database it's not a value object. Example: The domain model looks like this (C

How to share validation between Forms and Value Objects in Domain Driven Design?

自闭症网瘾萝莉.ら 提交于 2019-12-17 20:12:39
问题 #1. Validate EmailAddress on the Form I have a backend form class with an emailAddress property that has validation logic so that I can return an error message back to the user. I validate all form inputs with something like: $form->fillWith($request->input()); if($form->validate()){ $form->dispatch($command); // if synchronous, form takes command's messageBag } return response($form->getMessageBag()->toJson()); #2. Validate EmailAddress Value Object in the Command Handler I have a command

DDD - Mapping Value Objects with Fluent nHibernate in separate tables

浪子不回头ぞ 提交于 2019-12-13 06:56:50
问题 EDIT: Hi, trying an edit to get this question answered. In order to try improve the question, here is a straight to the point condensed version: Is the code below the way to go when mapping value objects to separate tables using fluent nhibernate, or is there an alternative? Hi, For the purpose of this question I am using nhibernate fluently configured. I'm steadily learning DDD but am after some clarification with the mapping of value objects. There seems to be a lot of information regarding

What is an example of a Value Object in PHP?

China☆狼群 提交于 2019-12-12 08:01:37
问题 I have read plenty of C# examples of Value Objects, and I understand that it is an "object" that is identified by it's values. If a value changes, the object is "new". However, that doesn't seem to make sense when it comes to PHP...either that, or I'm just not making the connection. Is a Value Object just a string? 回答1: To put this into context, in many OO languages, objects are compared by their identity . In pseudocode: bar = new Foo baz = new Foo bar == baz // false Even though both

Entity Framework Core: Fail to update Entity with nested value objects

≯℡__Kan透↙ 提交于 2019-12-12 07:17:49
问题 I have an entity that has a value object and this value object has another value object. My issue is that when updating the entity along with the value objects, the entity with the parent value object get updated but the child value object didn't. note, i used latest version of Entity Framework Core 2.1.0-rc1-final this is the parent entity Employee public class Employee : Entity { public string FirstName { get; private set; } public string LastName { get; private set; } public string Email {

NHibernate: Mapping protected members in component (composite-element) mapping

怎甘沉沦 提交于 2019-12-12 04:48:52
问题 I'm building an application which uses NHibernate mapping by code, and I am unable to map protected properties when I use a component mapping (equivalent to hbm composite-element mapping) for a collection of value objects. I am able to map protected properties in entity and compoment mappings for single value objects, it is just protected properties do not appear to be supported when mapping collections of value objects. public class MyEntity { public virtual int Id { get; protected set; }

java value object

纵饮孤独 提交于 2019-12-12 04:12:40
问题 I'm new to Java and I have to create a value object, (maybe it's called mapped object in Java) but my code doesn't seem to work, here is the value object: package ....; public class User { private int id; private int uid; private String name; public User() { // do something here } } and I assign a new value object like this: public boolean some_function() { User u = new User(); return true; // got a breakpoint here } So if I comment out "User u = new User();" I will go to the breakpoint but

EntityFramework naming conventions for DDD ValueObjects

徘徊边缘 提交于 2019-12-12 03:25:22
问题 I use Domain Driven Design Pattern in my project. I have some ValueObjects like PersianDate that has a long type property. the name of ValueObject property in database be CreatedOn_PersianDate but I want its name be CreatedOn. I can change this property directly but how can i do it by conventions ? (FixOValueObjectAttributeConvention) public class PersianDate : ValueObject<PersianDate> { public long Value {get; set;} } public class Account : Entity { public int Id {get; set;} public