Esempio n. 1
0
 protected function setUp()
 {
     MetaDataManager::registerDrivers(['annotations' => ['paths' => []]], true);
 }
Esempio n. 2
0
 /**
  * Register the meta data drivers
  */
 protected function setupMetaData()
 {
     MetaDataManager::registerDrivers($this->app->config->get('doctrine.meta.drivers', []), $this->app->config->get('doctrine.dev', false));
     MetaDataManager::resolved(function (Configuration $configuration) {
         // Debugbar
         if ($this->app->config->get('doctrine.debugbar', false) === true) {
             $debugStack = new DebugStack();
             $configuration->setSQLLogger($debugStack);
             $this->app['debugbar']->addCollector(new DoctrineCollector($debugStack));
         }
         // Automatically make table, column names, etc. like Laravel
         $configuration->setNamingStrategy($this->app->make(LaravelNamingStrategy::class));
         // Custom functions
         $configuration->setCustomDatetimeFunctions($this->app->config->get('doctrine.custom_datetime_functions'));
         $configuration->setCustomNumericFunctions($this->app->config->get('doctrine.custom_numeric_functions'));
         $configuration->setCustomStringFunctions($this->app->config->get('doctrine.custom_string_functions'));
         // Second level caching
         if ($this->app->config->get('cache.second_level', false)) {
             $configuration->setSecondLevelCacheEnabled(true);
             $cacheConfig = $configuration->getSecondLevelCacheConfiguration();
             $cacheConfig->setCacheFactory(new DefaultCacheFactory($cacheConfig->getRegionsConfiguration(), CacheManager::resolve($this->app->config->get('cache.default'))));
         }
     });
 }