The Clean Architecture in php


new ClassMethods(); return new



Download 2,26 Mb.
Pdf ko'rish
bet150/179
Sana24.06.2021
Hajmi2,26 Mb.
#100337
1   ...   146   147   148   149   150   151   152   153   ...   179
Bog'liq
The-Clean-Architecture-in-PHP-Kristopher-Wilson

new
ClassMethods();
return new
CustomerTable(
$factory
->
createGateway
(
$sm
->
get
(
'Zend\Db\Adapter\Adapter'
),
$hydrator
,
new
Customer(),
'customers'
),
$hydrator
);
⁴⁰
http://framework.zend.com/manual/current/en/user-guide/database-and-models.html


Zend Framework 2 Setup
130
},
]
]
];
We use our
TableGatewayFactory
to create a
TableGateway
instance to provide to our
CustomerTable
. We’re also passing an instance of the
ClassMethods
hydrator, as well as a
Customer
object and the name of the
customers
table.
Both the
TableGatewayFactory
and the
CustomerTable
need an instance of our hydrator, so we
declare that before-hand and provide it as needed to each class.
The only new piece here is the Zend Db Adapter.
We’ll need to configure that in the same file:
// config/autoload/global.php
// ...
return
[
'service_manager'
=>
[
'factories'
=>
[
'Zend\Db\Adapter\Adapter'
=>
'Zend\Db\Adapter\AdapterServiceFactory'
,
// ...
],
],
];
This tells the service manager to use the
AdapterServiceFactory
provided by Zend to give us
an instance of
Zend\Db\Adapter\Adapter
when needed. If you want to understand how all this
works, take a look at the ZF docs for more information, or dive into Zend’s source code if you’re
feeling extra adventurous.
Finally, we’ll setup a nearly identical entry for both the
OrderTable
and
InvoiceTable
:
// config/autoload/global.php

Download 2,26 Mb.

Do'stlaringiz bilan baham:
1   ...   146   147   148   149   150   151   152   153   ...   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