Storage.php 738 Bytes
Newer Older
Indra Raja's avatar
Indra Raja committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
<?php
namespace Application\Model\Test;

class Storage {

    public static function factory(\Zend\Db\Adapter\Adapter $adapter, $config = null) {
		//print_r($config);die;
        /* API log? */      
        $config1 = array( 'tables' => array(
            'MITRA' => 'MITRA',
        ));
        
        if(is_array($config)){
            $conf = array_merge($config1,$config);
        }else{
            $conf = $config1;
        }
        
        /* Oracle? Buat storage Oci8, selain itu pakai MySQL */
        if ($adapter->getDriver() instanceof \Zend\Db\Adapter\Driver\Oci8\Oci8) {
            return new Storage\Oci8($adapter, $conf);
        } else {
            return new Storage\Mysql($adapter, $conf);
        }
    }
}

?>