Skip to content

wrong-about-everything/lending

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# Tests

cd test
./../vendor/bin/phpunit --bootstrap="bootstrap.php" ./


# Domain

It's loan investment domain. A loan is split into tranches. Tranches can have different monthly interest percentages. Besides, each tranche has a maximum amount available to invest. There are investors who can invest into those tranches and get interest in the end of each month.


# Project structure

There three higher-level directories: domain, useCases and infrastructure. Domain is where, well, domain concepts live: entities, value-objects and repository interfaces. UseCases is where those domain entities are orchestrated by USeCases classes. Infrastructure code resided in infrastructure directory.


# Use cases

UseCase classes represent use-case approach from clean architecture. It's akin to an Application Service class from DDD: class that coordinates injected dependencies to carry out some use case logic.


# Action interface

This interface declares the basic functionality of any application: it acts upon a request and returns a response.


# Validation

I follow the approach of context validation. Hence it resides in commands, not entities. Plus with this approach it's way easier to map errors to UI -- and with no exceptions thrown.