'이 컨텍스트에서 OrderAdjust Service
에 대한 호출을 위임 한 Order.adjust()
메서드를 만들었습니다. Order.adjust()
을 가지면 Order
이 조정 작업을 소유하게된다는 이점이 있습니다. '도메인 개체와 서비스는 DDD에서 어떻게 상호 작용합니까?
어떻게 처리하나요? 도메인 서비스가 주입 되었습니까?
$order = new Order();
$order->adjust(???);
도메인 서비스가 상태가없는 경우 도메인 서비스에서 어떻게 작업을 수행 할 수 있습니까? 도메인 서비스가 엔터티에 주입되면 메서드는 참조에서 호출 될 수 있으므로 상태가 있어야합니다?
$service = DomainService();
$entity = DomainEntity();
$entity->operation($service);
// Inside DomainEntity
public function operation(DomainService &$service)
{
// Operations are delegated to the domain service reference
$service->operation();
$service->operation2();
}
$another_entity = AnotherDomainEntity();
// What happened in the first object must be known here
// otherwise what's the point?
$another_entity->operation($service);
이렇게 또는 응용 프로그램 서비스에서 수행해야합니까?
$domain_service = new DomainService();
$entity = new DomainEntity();
$another_entity = new AnotherDomainEntity();
$domain_service->performOperation($entity, $another_entity);
도메인 엔터티/개체 간의 작업은 어떻게됩니까? 일반적으로 도메인 객체는 어떻게 통신합니까? 인스턴스화 된 부분은 어디입니까?
코드 예제는 크게 감사하겠습니다.
자료 : http://stochastyk.blogspot.no/2008/05/domain-services-in-domain-driven-design.html
이 숙제가 있습니까? 왜 에세이 형식의 질문을하는거야? 그리고 왜 당신은 하나의 질문을 3 가지 따로 묻고 있습니까? –
이것은 숙제가 아닙니다. 나는 쉽게 읽을 수있는 구조를 만들었다. 질문은 관련되어 있습니다. 오히려 한 게시물에서 밀접하게 관련된 질문을합니다. 폐회 투표와 관련하여 :이 질문을 어떻게 올바르게 제기해야합니까? – Seralize