Skip to content

Bridge class to replicate the ease of Zend_Db in Zend Framework 2

License

Notifications You must be signed in to change notification settings

fballiano/zfbridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ZFBridge

Bridge class to replicate the ease of Zend_Db in Zend Framework 2.

In zf2 there's no fetchPairs, fetchCol or fetchOne methods from Db, this class tried to fill that gap with an easy approach.

If you find my work valuable, please consider sponsoring
Sponsor me on GitHub Buy me a coffee Donate via PayPal

LICENSE

The files in this archive are released under the New BSD license. You can find a copy of this license in LICENSE.txt.

USAGE

require_once "ZFBridge/Db.php";

// first of all we need the zf2 autoloader
$autoloader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
$autoloader->register();

// instancing db adapter
$adapter = new Zend\Db\Adapter\Adapter(array(
	'driver'       =>'Pdo_Mysql',
	'hostname'     => DB_READ_HOST,
	'username'     => DB_READ_USER,
	'password'     => DB_READ_PASS,
	'database'     => DB_READ_NAME,
	'characterset' => 'UTF8'
));

// replacing adapter with ZFBridge
$adapter = new \ZFBridge\Db($adapter);

// now we can use the old style fetchPairs etc
$adapter->fetchPairs("SELECT id, name FROM sampletable");

About

Bridge class to replicate the ease of Zend_Db in Zend Framework 2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages