Created
May 26, 2017 09:23
-
-
Save milinmestry/2617a60159ab8775e097711616293a63 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
// File: module/Tld/src/Tld/Module.php | |
namespace Tld; | |
use ZF\Apigility\Provider\ApigilityProviderInterface; | |
use classes\TldMaster; // this class is simple class outside ZF2 | |
class Module implements ApigilityProviderInterface | |
{ | |
public $ibrWebroot; | |
public function __construct() | |
{ | |
$this->ibrWebroot = dirname(dirname($_SERVER['DOCUMENT_ROOT'])); | |
} | |
public function getConfig() | |
{ | |
return include __DIR__ . '/../../config/module.config.php'; | |
} | |
public function getAutoloaderConfig() | |
{ | |
return array( | |
'ZF\Apigility\Autoloader' => array( | |
'namespaces' => array( | |
__NAMESPACE__ => __DIR__, | |
), | |
), | |
// Load the non-ZF classes from other directory | |
'Zend\Loader\StandardAutoloader' => array( | |
'namespaces' => array( | |
'classes' => $this->ibrWebroot . '/classes/', | |
), | |
), | |
); | |
} | |
public function getServiceConfig() | |
{ | |
require $this->ibrWebroot. '/includes/db_mysqli.php'; | |
return [ | |
'factories' => [ | |
'TldMaster' => function($sm) use ($mysqli) { | |
return new TldMaster($mysqli); // This is the class which is loaded into ZF2 | |
} | |
] | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment