本文整理汇总了PHP中Doctrine\ORM\Configuration::setSQLLogger方法的典型用法代码示例。如果您正苦于以下问题:PHP Configuration::setSQLLogger方法的具体用法?PHP Configuration::setSQLLogger怎么用?PHP Configuration::setSQLLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\Configuration
的用法示例。
在下文中一共展示了Configuration::setSQLLogger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: obterConfiguracao
private function obterConfiguracao($dados)
{
$this->config = new Configuration();
// Definição do driver de mapeamento
$metadata_driver = "Doctrine\\ORM\\Mapping\\Driver\\{$dados['metadata_driver']}";
if ($dados['metadata_driver'] == "AnnotationDriver") {
$driver = $this->config->newDefaultAnnotationDriver(array(MODELO), true);
} else {
$driver = new $metadata_driver(CONFIG . DS . 'orm');
}
if (!empty($dados['map_paths'])) {
$driver->addPaths(preg_split('/, ?/', $dados['map_paths']));
}
$this->config->setMetadataDriverImpl($driver);
// Configurações de proxies
$this->config->setProxyDir(RAIZ . DS . $dados['proxy_dir']);
$this->config->setProxyNamespace($dados['proxy_namespace']);
$this->config->setAutoGenerateProxyClasses($dados['auto_proxies']);
// Definição da estratégia de caches de consultas e metadados
$metadata_cache = "Doctrine\\Common\\Cache\\{$dados['metadata_cache']}";
$query_cache = "Doctrine\\Common\\Cache\\{$dados['query_cache']}";
$result_cache = "Doctrine\\Common\\Cache\\{$dados['query_cache']}";
$this->config->setMetadataCacheImpl(new $metadata_cache());
$this->config->setQueryCacheImpl(new $query_cache());
$this->config->setResultCacheImpl(new $result_cache());
// Ferramenta de log de consultas
if (!empty($dados['sql_logger'])) {
$sql_logger = "Doctrine\\DBAL\\Logging\\{$dados['sql_logger']}";
$logger = new $sql_logger();
$this->config->setSQLLogger($logger);
}
}
示例2: __construct
public function __construct()
{
// load database configuration from CodeIgniter
require_once APPPATH . 'config/development/database.php';
// Set up class loading. You could use different autoloaders, provided by your favorite framework,
// if you want to.
require_once APPPATH . 'libraries/Doctrine/Common/ClassLoader.php';
$doctrineClassLoader = new ClassLoader('Doctrine', APPPATH . 'libraries');
$doctrineClassLoader->register();
$entitiesClassLoader = new ClassLoader('models', rtrim(APPPATH, "/"));
$entitiesClassLoader->register();
$proxiesClassLoader = new ClassLoader('Proxies', APPPATH . 'models/proxies');
$proxiesClassLoader->register();
// Set up caches
$config = new Configuration();
$cache = new ArrayCache();
$config->setMetadataCacheImpl($cache);
$driverImpl = $config->newDefaultAnnotationDriver(array(APPPATH . 'models/Entities'));
$config->setMetadataDriverImpl($driverImpl);
$config->setQueryCacheImpl($cache);
$config->setQueryCacheImpl($cache);
// Proxy configuration
$config->setProxyDir(APPPATH . '/models/proxies');
$config->setProxyNamespace('Proxies');
// Set up logger
$logger = new EchoSQLLogger();
$config->setSQLLogger($logger);
$config->setAutoGenerateProxyClasses(TRUE);
// Database connection information
$connectionOptions = array('driver' => 'pdo_mysql', 'user' => $db['default']['username'], 'password' => $db['default']['password'], 'host' => $db['default']['hostname'], 'dbname' => $db['default']['database']);
// Create EntityManager
$this->em = EntityManager::create($connectionOptions, $config);
}
示例3: __construct
public function __construct()
{
// load database configuration from CodeIgniter
require_once APPPATH . 'config/database.php';
// Set up class loading. You could use different autoloaders, provided by your favorite framework,
// if you want to.
//require_once APPPATH.'libraries/Doctrine/Common/ClassLoader.php';
// We use the Composer Autoloader instead - just set
// $config['composer_autoload'] = TRUE; in application/config/config.php
//require_once APPPATH.'vendor/autoload.php';
//A Doctrine Autoloader is needed to load the models
$entitiesClassLoader = new ClassLoader('Entities', APPPATH . "models");
$entitiesClassLoader->register();
// Set up caches
$config = new Configuration();
$cache = new ArrayCache();
$config->setMetadataCacheImpl($cache);
$driverImpl = $config->newDefaultAnnotationDriver(array(APPPATH . 'models/Entities'));
$config->setMetadataDriverImpl($driverImpl);
$config->setQueryCacheImpl($cache);
$config->setQueryCacheImpl($cache);
// Proxy configuration
$config->setProxyDir(APPPATH . '/models/proxies');
$config->setProxyNamespace('Proxies');
// Set up logger
$logger = new EchoSQLLogger();
$config->setSQLLogger($logger);
$config->setAutoGenerateProxyClasses(TRUE);
// Database connection information
$connectionOptions = array('driver' => 'pdo_mysql', 'user' => 'dev_pila', 'password' => 'damienludothomas', 'host' => 'localhost', 'dbname' => 'tradr');
// Create EntityManager
$this->em = EntityManager::create($connectionOptions, $config);
}
示例4: createEntityManager
public static function createEntityManager($database)
{
$config = new Doctrine\ORM\Configuration();
// annotations
$annotationDriver = $config->newDefaultAnnotationDriver(array(APP_DIR . '/Model', NEURON_DIR . '/Model'));
$config->setMetadataDriverImpl($annotationDriver);
// proxy
$config->setProxyNamespace('Neuron\\Proxy');
$config->setProxyDir(TEMP_DIR);
// cache
$cache = Environment::isProduction() ? new NetteDoctrineCache() : new Doctrine\Common\Cache\ArrayCache();
$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);
// debugbar
$config->setSQLLogger(Doctrine2Panel::getAndRegister());
// entity manager
$em = Doctrine\ORM\EntityManager::create((array) $database, $config);
$evm = $em->getEventManager();
$evm->addEventSubscriber(new Doctrine\DBAL\Event\Listeners\MysqlSessionInit("utf8", "utf8_czech_ci"));
$evm->addEventSubscriber(new ValidationSubscriber());
$evm->addEventSubscriber(new CacheSubscriber());
$neonParser = new \Nette\NeonParser();
$aliases = $neonParser->parse(file_get_contents(APP_DIR . "/entityClassAliases.neon"));
$evm->addEventSubscriber(new \Neuron\Model\Doctrine\EntityClassAliasesSubscriber($aliases));
return $em;
}
示例5: __construct
public function __construct()
{
// load database configuration from CodeIgniter
if (!file_exists($file_path = APPPATH . 'config/' . ENVIRONMENT . '/database.php') && !file_exists($file_path = APPPATH . 'config/database.php')) {
throw new Exception('The configuration file database.php does not exist.');
}
require $file_path;
$entitiesClassLoader = new ClassLoader('models', rtrim(APPPATH, "/"));
$entitiesClassLoader->register();
$proxiesClassLoader = new ClassLoader('Proxies', APPPATH . 'models/Proxies');
$proxiesClassLoader->register();
// Set up caches
$config = new Configuration();
$cache = new ArrayCache();
$config->setMetadataCacheImpl($cache);
$driverImpl = $config->newDefaultAnnotationDriver(array(APPPATH . 'models/Entities'));
$config->setMetadataDriverImpl($driverImpl);
$config->setQueryCacheImpl($cache);
$config->setQueryCacheImpl($cache);
// Proxy configuration
$config->setProxyDir(APPPATH . '/models/Proxies');
$config->setProxyNamespace('Proxies');
// Set up logger
$logger = new EchoSQLLogger();
$config->setSQLLogger($logger);
$config->setAutoGenerateProxyClasses(true);
// Database connection information
$connectionOptions = $this->convertDbConfig($db['default']);
// Create EntityManager
$this->em = EntityManager::create($connectionOptions, $config);
}
示例6: setUpEntityManager
protected static function setUpEntityManager()
{
$config = new Configuration();
$config->setSQLLogger(null);
$config->setAutoGenerateProxyClasses(true);
$config->setProxyDir(\sys_get_temp_dir());
$config->setProxyNamespace('Proxies');
$config->setMetadataDriverImpl(static::getMetadataDriverImpl());
$config->setQueryCacheImpl(new ArrayCache());
$config->setMetadataCacheImpl(new ArrayCache());
$dbPath = __DIR__ . '/../db.sqlite';
if (file_exists($dbPath)) {
unlink($dbPath);
}
$connection = ['driver' => 'pdo_sqlite', 'path' => $dbPath];
// Event listeners
$interfaces = DoctrineBundleMapping::getDefaultImplementations();
$evm = new EventManager();
// Resolve entity target subscriber
$rtel = new ResolveTargetEntityListener();
foreach ($interfaces as $model => $implementation) {
$rtel->addResolveTargetEntity($model, $implementation, []);
}
$evm->addEventSubscriber($rtel);
// Load metadata subscriber
$lm = new LoadMetadataSubscriber([], $interfaces);
$evm->addEventSubscriber($lm);
static::$em = EntityManager::create($connection, $config, $evm);
}
示例7: register
/**
* @param EntityManagerInterface $em
* @param Configuration $configuration
*/
public function register(EntityManagerInterface $em, Configuration $configuration)
{
if ($this->debugbar->hasCollector('doctrine')) {
$debugStack = $this->debugbar->getCollector('doctrine')->getDebugStack();
} else {
$debugStack = new DebugStack();
$this->debugbar->addCollector(new DoctrineCollector($debugStack));
}
$configuration->setSQLLogger($debugStack);
}
示例8: init
/**
* Initializes resource
*
* @return Doctrine\ORM\EntityManager
*/
public function init()
{
$options = $this->getOptions();
$config = new Configuration();
if (APPLICATION_ENV == 'production' && function_exists('apc_fetch')) {
// @codeCoverageIgnoreStart
#extension_loaded() memcache, xcache, redis
$cache = new ApcCache();
} else {
// @codeCoverageIgnoreEnd
$cache = new ArrayCache();
}
#$driverImpl = $config->newDefaultAnnotationDriver($options['modelDirectory']);
// @todo Temporary(?) fix for using new AnnotationReader
$reader = new AnnotationReader();
#$reader->setEnableParsePhpImports(true);
$reader = new IndexedReader($reader);
$reader = new CachedReader($reader, $cache);
$driverImpl = new AnnotationDriver($reader, $options['modelDirectory']);
class_exists('Doctrine\\ORM\\Mapping\\Driver\\DoctrineAnnotations');
// Beware cache slams: http://doctrine-orm.readthedocs.org/en/2.0.x/reference/caching.html#cache-slams
$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);
$config->setResultCacheImpl($cache);
$config->setProxyDir($options['proxyDirectory']);
$config->setProxyNamespace($options['proxyNamespace']);
$config->setAutoGenerateProxyClasses($options['autoGenerateProxyClasses']);
$config->setMetadataDriverImpl($driverImpl);
// @codeCoverageIgnoreStart
if (null !== $options['logPath']) {
$sqlLogger = new SqlLogger($options['logPath']);
$config->setSQLLogger($sqlLogger);
Zend_Registry::set('sqlLogger', $sqlLogger);
}
// @codeCoverageIgnoreEnd
$entityManager = EntityManager::create($options['connection'], $config);
Service::setEntityManager($entityManager);
// Add BLOB data type mapping
if (!Type::hasType('gzblob')) {
Type::addType('gzblob', 'Rexmac\\Zyndax\\Doctrine\\DBAL\\Type\\GzBlob');
$entityManager->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('BLOB', 'gzblob');
}
// Add IP data type mapping
if (!Type::hasType('ip')) {
Type::addType('ip', 'Rexmac\\Zyndax\\Doctrine\\DBAL\\Type\\Ip');
$entityManager->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('IP', 'ip');
}
return $entityManager;
}
示例9: init
/**
* Sets up the doctrine configuration, caching, and entity manager
*
* @return EntityManager
*/
public function init()
{
$options = $this->getOptions();
if (!isset($options['connection'])) {
throw new ConfigException('No doctrine connection settings set');
}
$connection = $options['connection'];
if (!isset($options['proxy'])) {
throw new ConfigException('No doctrine proxy settings set');
}
if (!isset($options['proxy']['directory'])) {
throw new ConfigException('You must set a proxy directory');
}
$proxyDirectory = $options['proxy']['directory'];
$proxyNamespace = 'Epixa\\Proxy';
if (isset($options['proxy']['namespace'])) {
$proxyNamespace = $options['proxy']['namespace'];
}
$autoGenerateProxies = true;
if (isset($options['proxy']['autoGenerate'])) {
$autoGenerateProxies = $options['proxy']['autoGenerate'];
}
if (isset($options['cacheClass'])) {
$cache = new $options['cacheClass']();
} else {
$cache = new \Doctrine\Common\Cache\ArrayCache();
}
$entityPaths = array();
if (isset($options['entityPaths'])) {
$entityPaths = $options['entityPaths'];
}
$logger = null;
if (isset($options['loggerClass'])) {
$logger = new $options['loggerClass']();
}
$config = new Configuration();
$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);
$driverImpl = $config->newDefaultAnnotationDriver($entityPaths);
$config->setMetadataDriverImpl($driverImpl);
$config->setProxyDir($proxyDirectory);
$config->setProxyNamespace($proxyNamespace);
$config->setAutoGenerateProxyClasses($autoGenerateProxies);
if ($logger) {
$config->setSQLLogger($logger);
}
return EntityManager::create($connection, $config);
}
示例10: testCreateSQLLoggerWithPreviousExistingLoggerChainsLoggers
public function testCreateSQLLoggerWithPreviousExistingLoggerChainsLoggers()
{
$originalLogger = $this->getMock('Doctrine\\DBAL\\Logging\\SQLLogger');
$originalLogger->expects($this->once())->method('startQuery')->with($this->equalTo('test query'));
$injectedLogger = $this->getMock('Doctrine\\DBAL\\Logging\\DebugStack');
$injectedLogger->expects($this->once())->method('startQuery')->with($this->equalTo('test query'));
$configuration = new ORMConfiguration();
$configuration->setSQLLogger($originalLogger);
$this->services->setService('doctrine.configuration.orm_default', $configuration);
$this->services->setService('custom_logger', $injectedLogger);
$this->services->setService('Config', array('doctrine' => array('sql_logger_collector' => array('orm_default' => array('sql_logger' => 'custom_logger')))));
$this->factory->createService($this->services);
/* @var $logger \Doctrine\DBAL\Logging\SQLLogger */
$logger = $configuration->getSQLLogger();
$logger->startQuery('test query');
}
示例11: __construct
public function __construct()
{
// load database configuration and custom config from CodeIgniter
require APPPATH . 'config/database.php';
// Set up class loading.
require_once APPPATH . 'libraries/Doctrine/Common/ClassLoader.php';
$doctrineClassLoader = new \Doctrine\Common\ClassLoader('Doctrine', APPPATH . 'libraries');
$doctrineClassLoader->register();
$entitiesClassLoader = new \Doctrine\Common\ClassLoader('models', rtrim(APPPATH, '/'));
$entitiesClassLoader->register();
$proxiesClassLoader = new \Doctrine\Common\ClassLoader('Proxies', APPPATH . 'models');
$proxiesClassLoader->register();
$symfonyClassLoader = new \Doctrine\Common\ClassLoader('Symfony', APPPATH . 'libraries/Doctrine');
$symfonyClassLoader->register();
// Choose caching method based on application mode
if (ENVIRONMENT == 'production') {
$cache = new \Doctrine\Common\Cache\ApcCache();
} else {
$cache = new \Doctrine\Common\Cache\ArrayCache();
}
// Set some configuration options
$config = new Configuration();
// Metadata driver
$driverImpl = $config->newDefaultAnnotationDriver(APPPATH . 'models');
$config->setMetadataDriverImpl($driverImpl);
// Caching
$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);
// Proxies
$config->setProxyDir(APPPATH . 'models/Proxies');
$config->setProxyNamespace('Proxies');
if (ENVIRONMENT == 'development') {
$config->setAutoGenerateProxyClasses(TRUE);
} else {
$config->setAutoGenerateProxyClasses(FALSE);
}
// SQL query logger
if (DEBUGGING) {
$logger = new \Doctrine\DBAL\Logging\EchoSQLLogger();
$config->setSQLLogger($logger);
}
// Database connection information
$connectionOptions = array('driver' => 'pdo_mysql', 'user' => $db['default']['username'], 'password' => $db['default']['password'], 'host' => $db['default']['hostname'], 'dbname' => $db['default']['database'], 'charset' => $db['default']['char_set'], 'driverOptions' => array('charset' => $db['default']['char_set']));
// Create EntityManager
$this->em = EntityManager::create($connectionOptions, $config);
}
示例12: create
/**
* Factory method which creates an EntityManager.
*
* @return \Doctrine\ORM\EntityManager
*/
public function create()
{
$config = new Configuration();
$config->setClassMetadataFactoryName('TYPO3\\Flow\\Persistence\\Doctrine\\Mapping\\ClassMetadataFactory');
$cache = new \TYPO3\Flow\Persistence\Doctrine\CacheAdapter();
// must use ObjectManager in compile phase...
$cache->setCache($this->objectManager->get('TYPO3\\Flow\\Cache\\CacheManager')->getCache('Flow_Persistence_Doctrine'));
$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);
$resultCache = new \TYPO3\Flow\Persistence\Doctrine\CacheAdapter();
// must use ObjectManager in compile phase...
$resultCache->setCache($this->objectManager->get('TYPO3\\Flow\\Cache\\CacheManager')->getCache('Flow_Persistence_Doctrine_Results'));
$config->setResultCacheImpl($resultCache);
if (class_exists($this->settings['doctrine']['sqlLogger'])) {
$config->setSQLLogger(new $this->settings['doctrine']['sqlLogger']());
}
$eventManager = $this->buildEventManager();
$flowAnnotationDriver = $this->objectManager->get('TYPO3\\Flow\\Persistence\\Doctrine\\Mapping\\Driver\\FlowAnnotationDriver');
$config->setMetadataDriverImpl($flowAnnotationDriver);
$proxyDirectory = \TYPO3\Flow\Utility\Files::concatenatePaths(array($this->environment->getPathToTemporaryDirectory(), 'Doctrine/Proxies'));
\TYPO3\Flow\Utility\Files::createDirectoryRecursively($proxyDirectory);
$config->setProxyDir($proxyDirectory);
$config->setProxyNamespace('TYPO3\\Flow\\Persistence\\Doctrine\\Proxies');
$config->setAutoGenerateProxyClasses(FALSE);
$entityManager = \Doctrine\ORM\EntityManager::create($this->settings['backendOptions'], $config, $eventManager);
$flowAnnotationDriver->setEntityManager($entityManager);
\Doctrine\DBAL\Types\Type::addType('objectarray', 'TYPO3\\Flow\\Persistence\\Doctrine\\DataTypes\\ObjectArray');
if (isset($this->settings['doctrine']['filters']) && is_array($this->settings['doctrine']['filters'])) {
foreach ($this->settings['doctrine']['filters'] as $filterName => $filterClass) {
$config->addFilter($filterName, $filterClass);
$entityManager->getFilters()->enable($filterName);
}
}
if (isset($this->settings['doctrine']['dql']) && is_array($this->settings['doctrine']['dql'])) {
$this->applyDqlSettingsToConfiguration($this->settings['doctrine']['dql'], $config);
}
return $entityManager;
}
示例13: __construct
public function __construct()
{
// Load configuration from CI - make sure to check for environment-specific config
if (defined('ENVIRONMENT') and file_exists(APPPATH . 'config/' . ENVIRONMENT . '/database.php')) {
require_once APPPATH . 'config/' . ENVIRONMENT . '/database.php';
} else {
require_once APPPATH . 'config/database.php';
}
// set up class loading. We don't have to use Doctrine's here
require_once APPPATH . 'libraries/Doctrine/Common/ClassLoader.php';
$doctrineClassLoader = new ClassLoader('Doctrine', APPPATH . 'libraries');
$doctrineClassLoader->register();
$entitiesClassLoader = new ClassLoader('models', rtrim(APPPATH, '/'));
$entitiesClassLoader->register();
$proxiesClassLoader = new ClassLoader('Proxies', APPPATH . 'models/proxies');
$proxiesClassLoader->register();
// Set up caches
$config = new Configuration();
$cache = new ArrayCache();
$config->setMetadataCacheImpl($cache);
$driverImpl = $config->newDefaultAnnotationDriver(array(APPPATH . 'models/Entities'));
$config->setMetadataDriverImpl($driverImpl);
$config->setQueryCacheImpl($cache);
// This line appears twice in documentationl not sure if needed?
$config->setQueryCacheImpl($cache);
// Proxy configuration
$config->setProxyDir(APPPATH . '/models/proxies');
$config->setProxyNamespace('Proxies');
// Set up logger
$logger = new EchoSQLLogger();
$config->setSQLLogger($logger);
$config->setAutoGenerateProxyClasses(TRUE);
// DB Connection
$connectionOptions = array('driver' => 'pdo_mysql', 'user' => $db['default']['username'], 'password' => $db['default']['password'], 'host' => $db['default']['hostname'], 'dbname' => $db['default']['database']);
// Create EntityManager
$this->em = EntityManager::create($connectionOptions, $config);
}
示例14: setUp
public function setUp()
{
$reader = new AnnotationReader();
$driver = new AnnotationDriver($reader);
$driver->addPaths(array(__DIR__ . '/Fixtures'));
$config = new Configuration();
$config->setMetadataCacheImpl(new ArrayCache());
$config->setQueryCacheImpl(new ArrayCache());
$config->setProxyDir(sys_get_temp_dir());
$config->setProxyNamespace('SimpleThings\\EntityAudit\\Tests\\Proxies');
$config->setMetadataDriverImpl($driver);
$conn = array('driver' => $GLOBALS['DOCTRINE_DRIVER'], 'memory' => $GLOBALS['DOCTRINE_MEMORY'], 'dbname' => $GLOBALS['DOCTRINE_DATABASE'], 'user' => $GLOBALS['DOCTRINE_USER'], 'password' => $GLOBALS['DOCTRINE_PASSWORD'], 'host' => $GLOBALS['DOCTRINE_HOST']);
if (isset($GLOBALS['DOCTRINE_PATH'])) {
$conn['path'] = $GLOBALS['DOCTRINE_PATH'];
}
$auditConfig = new AuditConfiguration();
$auditConfig->setCurrentUsername("beberlei");
$auditConfig->setAuditedEntityClasses($this->auditedEntities);
$auditConfig->setGlobalIgnoreColumns(array('ignoreme'));
$this->auditManager = new AuditManager($auditConfig);
$this->auditManager->registerEvents($evm = new EventManager());
if (php_sapi_name() == 'cli' && isset($_SERVER['argv']) && (in_array('-v', $_SERVER['argv']) || in_array('--verbose', $_SERVER['argv']))) {
$config->setSQLLogger(new EchoSQLLogger());
}
$this->em = EntityManager::create($conn, $config, $evm);
$schemaTool = new SchemaTool($this->em);
$em = $this->em;
try {
$schemaTool->createSchema(array_map(function ($value) use($em) {
return $em->getClassMetadata($value);
}, $this->schemaEntities));
} catch (\Exception $e) {
if ($GLOBALS['DOCTRINE_DRIVER'] != 'pdo_mysql' || !($e instanceof \PDOException && strpos($e->getMessage(), 'Base table or view already exists') !== false)) {
throw $e;
}
}
}
示例15: dirname
use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Doctrine\Common\ClassLoader, Doctrine\ORM\Configuration, Doctrine\ORM\EntityManager, Doctrine\Common\Cache\ArrayCache, Doctrine\DBAL\Logging\EchoSQLLogger;
define('APPPATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
require_once APPPATH . 'libraries/Doctrine/Common/ClassLoader.php';
$doctrineClassLoader = new ClassLoader('Doctrine', APPPATH . 'libraries');
$doctrineClassLoader->register();
$entitiesClassLoader = new ClassLoader('models', rtrim(APPPATH, "/"));
$entitiesClassLoader->register();
$proxiesClassLoader = new ClassLoader('Proxies', APPPATH . 'models/proxies');
$proxiesClassLoader->register();
// Set up caches
$config = new Configuration();
$cache = new ArrayCache();
$config->setMetadataCacheImpl($cache);
//$driverImpl = $config->newDefaultAnnotationDriver(array(APPPATH.'models/Entities'));
//$config->setMetadataDriverImpl($driverImpl);
$config->setMetadataDriverImpl(new Doctrine\ORM\Mapping\Driver\XmlDriver(APPPATH . 'models'));
$config->setQueryCacheImpl($cache);
$config->setQueryCacheImpl($cache);
// Proxy configuration
$config->setProxyDir(APPPATH . '/models/proxies');
$config->setProxyNamespace('Proxies');
// Set up logger
$logger = new EchoSQLLogger();
$config->setSQLLogger($logger);
$config->setAutoGenerateProxyClasses(TRUE);
// Database connection information
$connectionOptions = array('driver' => 'pdo_mysql', 'user' => 'root', 'password' => 'fp87694fbr', 'host' => 'localhost', 'dbname' => 'mostratec');
// Create EntityManager
$em = EntityManager::create($connectionOptions, $config);
return ConsoleRunner::createHelperSet($em);