phphackes/zend-tablegateway-factory

Creates TableGateways according to schema and table name provided.

v1.0.0 2018-06-26 18:47 UTC

This package is not auto-updated.

Last update: 2024-05-02 23:50:04 UTC


README

Maintainability Latest Stable Version Latest Unstable Version

Setup the factory

All the factory requires is a database adapter.

$adapter = $serviceLocator->get('Zend/Db/Adapter/Adapter');
$factory = new TableGatewayFactory($adapter);

Getting a TableGateway

Since you have provided the adapter now you can directly create the TableGateway using just the table name or also a schema name.

$users = $factory->create('users');
$users = $factory->create('users', 'myAuthSchema');

Running the commands

Now the TableGateway is created, you can use it like it have always been.

$rows = $users->select([
   'username' => 'admin',
   'password' => 'nimda'
])->toArray();