phphacks / zend-tablegateway-factory

Creates TableGateways according to schema and table name provided.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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();

About

Creates TableGateways according to schema and table name provided.

License:MIT License


Languages

Language:PHP 100.0%