stefano / stefano-db
Db Modul extend Zend Framework 2
Installs: 6 490
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/stefano/stefano-db
Requires
- php: >=7.0.0
- stefano/stefano-nested-transaction: ^0.1.0
- zendframework/zend-db: ^2.0.0
- zendframework/zend-servicemanager: ^3.0.0
Requires (Dev)
- mockery/mockery: ^0.9.0
- phpunit/phpunit: ^6.0.0
- satooshi/php-coveralls: dev-master
README
Zend DB from v.2.4.0 support nested transactions. Please use Zend Db instead of this library. This library is NOT MAINTAINED anymore.
Installation using Composer
- Run command  composer require stefano/stefano-db
Features
- extend Zend Framework 2 Database adapter. For more info see Zend Db
- nested transaction. For more info see Stefano nested transaction
- execute defined queries after db connection will be created
Db Adapter Configuration
//$option for more info see Zend Framework 2 Db documentation
$adapter = new \StefanoDb\Adapter\Adapter($options);
Nested transaction API
$adapter->begin();
$adapter->commit();
$adapter->rollback();
Usage with Zend Framework 2 MVC
- single DB connection configuration
return array(
    //single DB connection
    'db' => array(
        'driver' => '',
        'database' => '',
        'username' => '',
        'password' => '',
        'sqls' => array(
            "SET time_zone='+0:00'",
            "....."
        ),
    ),
    'service_manager' => array(
        'factories' => array(
            'Zend\Db\Adapter\Adapter'
                => '\StefanoDb\Adapter\Service\AdapterServiceFactory',
        ),
    ),
);
- multiple DB connection configuration
return array(
    'db' => array(
        'adapters' => array(
            'Db/Write' => array(
                'driver' => '',
                'database' => '',
                'username' => '',
                'password' => '',
                'sqls' => array(
                    "SET time_zone='+0:00'",
                    "....."
                ),
            ),
            'Db/Read' => array(
                'driver' => '',
                'database' => '',
                'username' => '',
                'password' => '',
                'sqls' => array(
                    "SET time_zone='+0:00'",
                    "....."
                ),
            ),
        ),
    ),
    'service_manager' => array(
        'abstract_factories' => array(
            '\StefanoDb\Adapter\Service\AdapterAbstractServiceFactory',
        ),
    ),
);