Zend Framework 2 – Database access pattern

,

TableGateway-ről, de akár, a Zend Framework 2 -ről : Yes, for small projects it can be, or seem like, overkill. But as project complexity grows, as it invariably does, you won’t miss the time not spent maintaining your application.

TableGateway ,RowGateway https://leanpub.com/using-zend-framework-2/read

Feature
ZF2
Symfony 2
Cake PHP
CodeIgniter
Yii
Current version
2.2.1
2.3.1
2.3.6
2.1.3
1.1.13
Distribution
3 Mb
4.4 Mb
2.0 Mb
2.2 Mb
3.9 Mb
archive size
Installation
Composer
Composer
Archive
Archive
Archive
Compatibility
Bad (requires
Bad (requires
Good
Good
Good
with
SSH and
SSH and
shared hostings
vhosts)
vhosts)
Monolithic or
Components
Components
Components
Components
Monolithic
component-
based?
Prefer
Configuration
Configuration
Conventions
Conventions
Conventions
conventions
or configs?
Database access
Data Mapper
Data Mapper
Active Record
Traditional
Active Record,
pattern
(Doctrine/ORM),
(Doctrine/ORM)
or
PDO
Table Gateway,
Active Record
Row Gateway
Database
Yes (Doctrine-
Yes (Doctrine-
Yes
Yes
Yes
migrations
provided)
provided)
CSS Framework
Twitter
Twitter
Any
Any
Blueprint CSS
Bootstrap
Bootstrap
View Template
Any you want, or
Twig
Smarty/Twig
Any you want,
None or Prado
Language
none at all
(recommended)
or none
Unit testing
Yes (PHPUnit)
Yes (PHPUnit)
Yes (PHPUnit)
Yes (PHPUnit)
Yes (PHPUnit-
support
based)
Functional
Yes (PHPUnit)
Yes (PHPUnit)
Yes
No
Yes (Selenium)
testing
Database
Yes (Doctrine-
Yes (Doctrine
Yes
No
Yes
fixtures
provided)
bundle)

ZendDbTableGateway¶

Are TableGateways Worth it in Zend Framework 2?

Az üzleti logika helye: The TableGateway class contains table-aware logic, such as queries to fetch all and fetch by specific criteria. The model class is table agnostic. It only knows about the properties that it needs data for.

Then, we have the module configuration, which binds the two together. Firstly, we have a TableGateway configuration, so we know which table we’re binding to the TableGateway. Then we have the table configuration. I’ve taken this configuration further by using a HydratingResultset object. What this does, is to also implement the RowGateway pattern.

Zend Framework2: Building a CRUD app by using Table Gateway1

Blogbook : PHP | Javascript | Laravel | Corcel | CodeIgniter | VueJs | ReactJs | WordPress