The Clean Architecture in php


namespace CleanPhp\Invoicer\Domain\Repository; interface



Download 2,26 Mb.
Pdf ko'rish
bet139/179
Sana24.06.2021
Hajmi2,26 Mb.
#100337
1   ...   135   136   137   138   139   140   141   142   ...   179
Bog'liq
The-Clean-Architecture-in-PHP-Kristopher-Wilson

namespace
CleanPhp\Invoicer\Domain\Repository;
interface
RepositoryInterface {
public function
getById
(
$id
);
public function
getAll
();
public function
persist
(
$entity
);
public function
begin
();
public function
commit
();
}
Now let’s create some interfaces that represent the actual entities, that extend and inherit the
functionality of
RepositoryInterface
.
Customers
// src/Domain/Repository/CustomerRepositoryInterface.php
namespace
CleanPhp\Invoicer\Domain\Repository;
interface
CustomerRepositoryInterface
extends
RepositoryInterface {
}
Orders
// src/Domain/Repository/OrderRepositoryInterface.php
namespace
CleanPhp\Invoicer\Domain\Repository;
interface
OrderRepositoryInterface
extends
RepositoryInterface {
}
Invoices


Building Our Domain
108
// src/Domain/Repository/InvoiceRepositoryInterface.php
namespace
CleanPhp\Invoicer\Domain\Repository;
interface
InvoiceRepositoryInterface
extends
RepositoryInterface {
}
These repositories each represent an entity, and define a contract that each concrete repository
must follow. Additionally, we’ll use these interfaces to type-hint dependency injection in each
instance where we need them, so that we can ensure our classes will get the correct functionality
they need.
As part of our invoicing process, we need to find all orders that have not yet been invoiced. We
can define this need by adding a method to the
OrderRepositoryInterface
:
// src/Domain/Repository/OrderRepositoryInterface.php

Download 2,26 Mb.

Do'stlaringiz bilan baham:
1   ...   135   136   137   138   139   140   141   142   ...   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