¿Dónde debo poner esto?
, ( ) () , : : ? , - - . , , , - :
? , .
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.
-, : “ ? ?”
-