Last active
August 29, 2015 14:27
-
-
Save chukShirley/3593585aa6ed0cd9de70 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// /config/autoload/ibmiToolkit.development.php | |
// Set toolkit options | |
$settings = [ | |
'stateless' => true, | |
'plugSize' => '15M', | |
'debug' => true, | |
'debugLogFile' => '/usr/local/zendsvr6/var/log/toolkit_debug' . date("Ymd") . '.log', | |
'naming_mode' => DB2_I5_NAMING_ON | |
]; | |
// Add toolkit adapter | |
return array( | |
'ibmiToolkit' => $settings, | |
'service_manager' => array( | |
'aliases' => array( | |
'ibmiToolkit_zend_db_adapter' => (isset($settings['zend_db_adapter'])) ? $settings['zend_db_adapter']: 'Zend\Db\Adapter\Adapter', | |
), | |
), | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// /Module/IbmiToolkit/src/IbmiToolkit/Factory/ToolkitFactory.php | |
namespace IbmiToolkit\Factory; | |
use Zend\ServiceManager\FactoryInterface; | |
use Zend\ServiceManager\ServiceLocatorInterface; | |
/** | |
* Class ToolkitFactory | |
* @package IbmiToolkit\Factory | |
*/ | |
class ToolkitFactory implements FactoryInterface | |
{ | |
/** | |
* @param ServiceLocatorInterface $sm | |
* @return \ToolkitService | |
*/ | |
public function createService(ServiceLocatorInterface $sm) | |
{ | |
$config = $sm->get('Config'); | |
$settings = $config['ibmiToolkit']; | |
$dbAdapter = $sm->get('ibmiToolkit_zend_db_adapter'); | |
$conn = $dbAdapter->getDriver()->getConnection()->getResource(); | |
require('ToolkitService.php'); | |
$tk = \ToolkitService::getInstance($conn,$settings['naming_mode']); | |
$tk->setOptions($settings); | |
return $tk; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment