protected function setupMetaData()
    {
        MetaDataManager::registerDrivers(
            $this->config['meta']['drivers'],
            $this->config['dev']
        );

        MetaDataManager::resolved(function (Configuration $configuration) {

            // Debugbar
            if ($this->config['debugbar'] === true) {
                $debugStack = new DebugStack();
                $configuration->setSQLLogger($debugStack);
                $this->app['debugbar']->addCollector(
                    new DoctrineCollector($debugStack)
                );
            }

            $configuration->getMetadataDriverImpl()->addPaths([
                __DIR__ . '/Migrations',
                __DIR__ . '/Auth/Passwords'
            ]);

            // Automatically make table, column names, etc. like Laravel
            $configuration->setNamingStrategy(
                $this->app->make(LaravelNamingStrategy::class)
            );

            // Custom functions
            $configuration->setCustomDatetimeFunctions($this->config['custom_datetime_functions']);
            $configuration->setCustomNumericFunctions($this->config['custom_numeric_functions']);
            $configuration->setCustomStringFunctions($this->config['custom_string_functions']);

            // Second level caching
            if ($this->config['cache']['second_level']) {
                $configuration->setSecondLevelCacheEnabled(true);

                $cacheConfig = $configuration->getSecondLevelCacheConfiguration();
                $cacheConfig->setCacheFactory(
                    new DefaultCacheFactory(
                        $cacheConfig->getRegionsConfiguration(),
                        CacheManager::resolve(
                            $this->config['cache']['default']
                        )
                    )
                );
            }
        });
    }