To which level does it belong: application or domain?

Where should I put this?

, ( ) () , : : ? , - - . , , , - :





? , .





2

(Dependency rule): . , . (Infrastructure) (Application). (Domain). , . , /API, . , , . . ; , -- (Application-as-an-interface).





, ยซ ยป. PurchaseEbookController



, , PurchaseEbook



, PurchaseEbookService



. , . Purchase



PurchaseRepository



, . PurchaseRepositoryUsingSql



, PurchaseRepository



.





PurchaseRepository



? (, ). Purchase



. . , , , . , .





? , . API, .





-- ApplicationInterface?

, : API, , interface



. ,





namespace Application;

interface ApplicationInterface
{
    public function purchaseEbook(PurchaseEbook $command): void;

    /**
     * @return EbookForList[]
     */    
    public function listAvailableEbooks(): array;
}
      
      



, listAvailableEbooks()



, , ApplicationInterface



.





, -- - , . , , . , . ApplicationInterface



, , , . , โ€‹โ€‹ , . .






PHP-? โ€” .

Middle+ , PHP.



-, : โ€œ ? ?โ€



-









All Articles