franz-deleon/fdl-gateway-manager
Composer 安装命令:
composer require franz-deleon/fdl-gateway-manager
包简介
A ZF2 module use to manage Zend Db gateway instances
README 文档
README
The Gateway Manager is a Zend Framework 2 module designed as a wrapper for Zend\Db\TableGateway\TableGateway so that a developer can easily assemble and manage multiple gateways with ease without cluttering your module.php.
This is useful if you are using mappers, dbtables and entities. The Gateway Manager will automatically inject and map your entities to your dbtables.
Requirements
- Zend Framework 2.2
- PHP 5.3
Usage
-
In your module's module.config.php add:
// module.config.php inside an array 'loc_gateway_manager_assets' => array( 'entities' => 'namespace\to\entity\dir', 'tables' => 'namespace\to\tables\dir', ) -
Create an entity in your specified 'entities' namespace:
// Users.php namespace namespace\to\entity\dir; class Users { public function getID() ... public function setID() ... public function getName() ... public function setName($name) ... }If you are using a table to create with your mapper
// UsersTable.php namespace namespace\to\tables\dir; class UsersTable implements \LocGatewayManager\Gateway\AbstractTable { $tableName = 'MY_USERS'; // actual table name in db $primaryKey = 'ID' // primary key column }* This table will act as your inteded tablegateway
-
Use the FactoryManager:
$gm = $sm->get('LocGatewayManager'); $tableGateway = $gm->factory(array( 'entity_name' => 'Users', 'result_set_name' => 'HydratingResultSet' ), 'users'); $tableGateway->fetchAll(); // later anywhere where you can have a service manager $users = $sm->get('LocGatewayManager')->get('users'); $users->fetchAll();
TODOS:
@todo rename GatewayFactoryProcessor to GatewayFactoryUtilities
@todo add assemble() to WorkerInterface
统计信息
- 总下载量: 25
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-10-23