public function __construct(Doctrine\Common\Cache\CacheProvider $cacheDriver = null) { $paths = [__DIR__ . '/../Entity']; $isDevMode = true; $this->config = Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration($paths, $isDevMode, null, null, false); if ($cacheDriver !== null) { $this->cacheDriver = $cacheDriver; $this->config->setMetadataCacheImpl($this->cacheDriver); $this->config->setQueryCacheImpl($this->cacheDriver); $this->config->setResultCacheImpl($this->cacheDriver); } $this->eventManager = new Doctrine\Common\EventManager(); $this->addMysqlFunctions(); }
public function __construct(Doctrine\Common\Cache\CacheProvider $cacheDriver = null) { $paths = [__DIR__ . '/../Entity']; $isDevMode = true; $this->config = Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration($paths, $isDevMode); $xmlDriver = new Doctrine\ORM\Mapping\Driver\XmlDriver(realpath(__DIR__ . '/../Doctrine/Mapping')); $this->config->setMetadataDriverImpl($xmlDriver); $this->config->addEntityNamespace('vbscraper', 'pdt256\\vbscraper\\Entity'); if ($cacheDriver !== null) { $this->cacheDriver = $cacheDriver; $this->config->setMetadataCacheImpl($this->cacheDriver); $this->config->setQueryCacheImpl($this->cacheDriver); $this->config->setResultCacheImpl($this->cacheDriver); } }
public function __construct(Doctrine\Common\Cache\CacheProvider $cacheDriver = null) { $paths = [__DIR__ . '/../Entity']; $isDevMode = true; $this->config = Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration($paths, $isDevMode); $xmlDriver = new Doctrine\ORM\Mapping\Driver\XmlDriver(realpath(__DIR__ . '/../Doctrine/Mapping')); $this->config->setMetadataDriverImpl($xmlDriver); $this->config->addEntityNamespace('truecar', 'pdt256\\truecar\\Entity'); if ($cacheDriver !== null) { $this->cacheDriver = $cacheDriver; $this->config->setMetadataCacheImpl($this->cacheDriver); $this->config->setQueryCacheImpl($this->cacheDriver); $this->config->setResultCacheImpl($this->cacheDriver); } $tablePrefix = new TablePrefix($this->tablePrefix); $this->eventManager = new Doctrine\Common\EventManager(); $this->eventManager->addEventListener(Doctrine\ORM\Events::loadClassMetadata, $tablePrefix); }
/** * @param ServiceLocatorInterface $serviceLocator * @param Configuration $config */ public function setupDBALConfiguration(ServiceLocatorInterface $serviceLocator, Configuration $config) { $options = $this->getOptions($serviceLocator); $config->setResultCacheImpl($serviceLocator->get($options->resultCache)); $config->setSQLLogger($options->sqlLogger); foreach ($options->types as $name => $class) { if (Type::hasType($name)) { Type::overrideType($name, $class); } else { Type::addType($name, $class); } } }
/** * @param ContainerInterface $container * @param Configuration $config */ public function setupDBALConfiguration(ContainerInterface $container, Configuration $config) { $options = $this->getOptions($container); $config->setResultCacheImpl($container->get($options->resultCache)); $sqlLogger = $options->sqlLogger; if (is_string($sqlLogger) and $container->has($sqlLogger)) { $sqlLogger = $container->get($sqlLogger); } $config->setSQLLogger($sqlLogger); foreach ($options->types as $name => $class) { if (Type::hasType($name)) { Type::overrideType($name, $class); } else { Type::addType($name, $class); } } }
/** * @throws \Doctrine\DBAL\DBALException */ protected function connect() { $config = new DBAL\Configuration(); if ($this->appMode === ApplicationMode::DEVELOPMENT) { $config->setSQLLogger(new SQLLogger($this->logger)); } $config->setResultCacheImpl($this->cacheDriverFactory->create('db-queries')); return DBAL\DriverManager::getConnection($this->connectionParams, $config); }
public function setupDBALConfiguration(ServiceLocatorInterface $serviceLocator, Configuration $config) { $options = $this->getOptions($serviceLocator); $config->setResultCacheImpl($serviceLocator->get($options->resultCache)); $config->setSQLLogger($options->sqlLogger); }