Hi,
Question:
- Is it possible to access a variable or a state of an Aggregate Root from it’s Aggregate Member?
- Is it an anti-pattern in DDD concept for an Aggregate Member to access variable from it’s Aggregate Root?
I am quite new with DDD and Axon framework, through out my work, I found out that I need to access a state in Aggregate Root from an Aggregate Member while handling a command for some validation. I would like to know how to achieve that in Axon.
Scenario:
Aggregate Root
Aggregate
public class CarAggregate {
AggregateIdentifier private String plateNumber;
private String brand;
AggregateMember private List tyres;
}
Aggregate member:
Aggregate
public class TyreAggregate {
EntityId private String tyreId;
CommandHandler
public void handle(ChangeTyreCommand command){
// car brand validation for this command somehow
}
}