The Clean Architecture in php



Download 2,26 Mb.
Pdf ko'rish
bet122/179
Sana24.06.2021
Hajmi2,26 Mb.
#100337
1   ...   118   119   120   121   122   123   124   125   ...   179
Bog'liq
The-Clean-Architecture-in-PHP-Kristopher-Wilson

class
CustomerFactory
{
protected
$managerRepository
;
public function
__construct
(AccountManagerRepositoryInterface
$repo
) {
$this
->
managerRepository
=
$repo
;
}
public function
create
() {
$customer
=
new
Customer();
$customer
->
setAccountManager
(
$this
->
managerRepository
->
getNextAvailable
()
);
}
}
As our business rules and domain logic become more complex, using these factories start to make
sense. The important thing to remember is that these factories are completely decoupled from
the actual data storage. Their only dependence is upon the Domain Model.
So how exactly does an instance of
AccountManagerRepositoryInterface
get into the
CustomerFactory
?
And what exactly is the implementation of that interface? We’ll cover that soon in Database
Infrastructure / Persistence.
Services
Services, simply put, are responsible for doing things. These are usually processes, such as invoice
runs or some kind of cost build up analysis. Anything that involves business logic that is not
either creational (which belongs in a factory), or retrieving or persisting data (which belongs in
a repository). These services can depend on repository interfaces and factories to do their work.
Let’s look at an example service for generating invoices based off orders:

Download 2,26 Mb.

Do'stlaringiz bilan baham:
1   ...   118   119   120   121   122   123   124   125   ...   179




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish