1. Go to this page and download the library: Download sandrokeil/easy-config library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Sake\EasyConfig\Service\AbstractConfigurableFactory;
use Sake\EasyConfig\Service\OptionsClassInterface;
use Sake\EasyConfig\Service\MandatoryOptionsInterface;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
class MyDBALConnectionFactory extends AbstractConfigurableFactory implements FactoryInterface, OptionsClassInterface, MandatoryOptionsInterface
{
public function createService(ServiceLocatorInterface $serviceLocator)
{
// get option class for doctrine.connection.orm_default
// dont implement OptionsClassInterface to get an array of options
$options = $this->getOptions($serviceLocator);
// so you can do
$pdo = $options->getPdo();
$driverClass = $options->getDriverClass();
$wrapperClass = $options->getWrapperClass();
// create your instance
return $instance;
}
/**
* Returns a list of mandatory options which must be available
*
* @return array
*/
public function getMandatoryOptions()
{
return array(
'driverClass',
'params',
);
}
/**
* Return the option class name (fcqn) where options are injected via constructor
*
* @return string
*/
public function getOptionsClass()
{
return '\DoctrineORMModule\Options\DBALConnection';
}
/**
* Module name
*
* @return string
*/
public function getModule()
{
return 'doctrine';
}
/**
* Config scope
*
* @return string
*/
public function getScope()
{
return 'connection';
}
/**
* Config name
*
* @return string
*/
public function getName()
{
return 'orm_default';
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.