According to the definition by Robert Martin, high level modules should not depend on low level modules, instead both should depend on abstractions.
So if I have a domain entity Invoice
that uses an interface InvoiceRepository
for persistence, and an infrastructure layer where this interface is implemented in a class PdoInvoiceRepository
, then both modules - the entity and the persistence mechanism - depend on the abstraction (interface)?
Further, if the methods in above interface do not depend on the implementation details but instead express the abstracted needs of my domain model, then I have achieved dependency inversion?