phphackes / zend-tablegateway-factory
根据提供的模式和表名创建 TableGateways。
v1.0.0
2018-06-26 18:47 UTC
Requires
- zendframework/zend-db: ^2.9
Requires (Dev)
- phpunit/phpunit: ^7.2
This package is not auto-updated.
Last update: 2024-09-20 01:31:49 UTC
README
设置工厂
工厂所需的所有内容只是一个数据库适配器。
$adapter = $serviceLocator->get('Zend/Db/Adapter/Adapter'); $factory = new TableGatewayFactory($adapter);
获取 TableGateway
由于你已经提供了适配器,现在你可以直接使用表名或同时使用模式名来创建 TableGateway。
$users = $factory->create('users'); $users = $factory->create('users', 'myAuthSchema');
运行命令
现在 TableGateway 已经创建,你可以像以前一样使用它。
$rows = $users->select([ 'username' => 'admin', 'password' => 'nimda' ])->toArray();