diff --git a/config/services.php b/config/services.php
new file mode 100644
index 0000000..ea05e94
--- /dev/null
+++ b/config/services.php
@@ -0,0 +1,302 @@
+services();
+ $parameters = $container->parameters();
+ $container->import('services/orm.php');
+
+ $services->defaults()
+ ->private()
+ ->autowire()
+ ->autoconfigure()
+ ->bind('$rootDir', '%doctrine.website.root_dir%')
+ ->bind('$env', '%doctrine.website.env%')
+ ->bind('$projectsDir', '%doctrine.website.projects_dir%')
+ ->bind('$docsDir', '%doctrine.website.docs_dir%')
+ ->bind('$sourceDir', '%doctrine.website.source_dir%')
+ ->bind('$projectsData', '%doctrine.website.projects_data%')
+ ->bind('$webpackBuildDir', '%doctrine.website.webpack_build_dir%')
+ ->bind('$projectIntegrationTypes', '%doctrine.website.project_integration.types%')
+ ->bind('$packagistUrlFormat', 'https://packagist.org/packages/%s.json')
+ ->bind('$dbPrefills', tagged_iterator('doctrine.website.db_prefill'))
+ ->bind('$templatesDir', '%doctrine.website.templates_dir%')
+ ->bind('$routes', '%doctrine.website.routes%');
+
+ $services->load('Doctrine\\Website\\', '../lib/*');
+
+ $services->set(SourceFileBuilder::class)
+ ->args([
+ service(SourceFileRenderer::class),
+ service(Filesystem::class),
+ [service(GuidesRstConverter::class), service(GuidesMarkdownConverter::class)],
+ ['/\/api\//'],
+ ]);
+
+ $services->set(StringTwigRenderer::class)
+ ->autowire(false)
+ ->args([
+ '%doctrine.website.templates_dir%',
+ [service(MainExtension::class), service(ProjectExtension::class), service(RoutingExtension::class)],
+ ]);
+
+ $services->alias(TwigRenderer::class, StringTwigRenderer::class);
+
+ $services->set(SourceFileRepository::class)
+ ->args([[service(SourceFileFilesystemReader::class), service(SourceFileRouteReader::class)]]);
+
+ $services->set(ControllerProvider::class)
+ ->args([[service(AtomController::class), service(BlogController::class), service(DocumentationController::class), service(HomepageController::class), service(PartnersController::class), service(ProjectController::class), service(SitemapController::class)]]);
+
+ $services->set(RequestCollectionProvider::class)
+ ->args([[service(PartnerRequests::class), service(ProjectRequests::class), service(ProjectVersionRequests::class)]]);
+
+ $services->alias(Site::class, \Doctrine\Website\Site::class);
+
+ $services->set(Application::class)
+ ->public()
+ ->autowire();
+
+ $services->set(ProjectDataRepository::class)
+ ->autowire();
+
+ $services->set(GithubClientProvider::class)
+ ->args([
+ inline_service(Client::class),
+ service(CacheItemPoolInterface::class),
+ '%doctrine.website.github.http_token%',
+ ]);
+
+ $services->set(Repo::class)
+ ->factory([service(GithubClientProvider::class), 'repositories']);
+
+ $services->set(Highlighter::class)
+ ->autowire();
+
+ $services->set(Parsedown::class, Parsedown::class)
+ ->autowire();
+
+ $services->set(\Symfony\Component\Console\Application::class)
+ ->autowire();
+
+ $services->set(Filesystem::class)
+ ->autowire();
+
+ $services->set(ArgumentResolver::class)
+ ->autowire();
+
+ $services->set(CacheItemPoolInterface::class, FilesystemAdapter::class)
+ ->autowire(false)
+ ->args([
+ '',
+ 0,
+ '%doctrine.website.cache_dir%/fscache',
+ ]);
+
+ $services->set('SendGrid', 'SendGrid')
+ ->autowire()
+ ->args(['%doctrine.website.send_grid.api_key%']);
+
+ $services->set(SearchClient::class)
+ ->autowire(false)
+ ->args([
+ '%doctrine.website.algolia.app_id%',
+ '%doctrine.website.algolia.admin_api_key%',
+ ])
+ ->factory([null, 'create']);
+
+ $services->set(\Doctrine\Website\Site::class)
+ ->args([
+ '%doctrine.website.title%',
+ '%doctrine.website.subtitle%',
+ '%doctrine.website.url%',
+ '%doctrine.website.keywords%',
+ '%doctrine.website.description%',
+ '%doctrine.website.env%',
+ '%doctrine.website.google_analytics_tracking_id%',
+ '%doctrine.website.assets_url%',
+ ]);
+
+ $services->set(BlogPostRepository::class)
+ ->public()
+ ->autowire(false)
+ ->args([BlogPost::class])
+ ->factory([service(EntityManagerInterface::class), 'getRepository']);
+
+ $services->set(DoctrineUserRepository::class)
+ ->public()
+ ->autowire(false)
+ ->args([DoctrineUser::class])
+ ->factory([service(EntityManagerInterface::class), 'getRepository']);
+
+ $services->set(PartnerRepository::class)
+ ->public()
+ ->autowire(false)
+ ->args([Partner::class])
+ ->factory([service(EntityManagerInterface::class), 'getRepository']);
+
+ $services->set(ProjectRepository::class)
+ ->public()
+ ->autowire(false)
+ ->args([Project::class])
+ ->factory([service(EntityManagerInterface::class), 'getRepository']);
+
+ $services->set(SitemapPageRepository::class)
+ ->autowire(false)
+ ->args([SitemapPage::class])
+ ->factory([service(EntityManagerInterface::class), 'getRepository']);
+
+ $services->set('doctrine.website.data_sources.db_prefill.doctrine_user', SimpleSource::class)
+ ->args([
+ DoctrineUser::class,
+ inline_service(ArrayDataSource::class)
+ ->args(['%doctrine.website.doctrine_users%']),
+ service(EntityManagerInterface::class),
+ ])
+ ->tag('doctrine.website.db_prefill');
+
+ $services->set('doctrine.website.data_sources.db_prefill.sitemap_pages', SimpleSource::class)
+ ->args([
+ SitemapPage::class,
+ service(SitemapPages::class),
+ service(EntityManagerInterface::class),
+ ])
+ ->tag('doctrine.website.db_prefill');
+
+ $services->set('doctrine.website.data_sources.db_prefill.blog_posts', SimpleSource::class)
+ ->args([
+ BlogPost::class,
+ service(BlogPosts::class),
+ service(EntityManagerInterface::class),
+ ])
+ ->tag('doctrine.website.db_prefill');
+
+ $services->set('doctrine.website.data_sources.db_prefill.projects', Projects::class)
+ ->args([
+ service(\Doctrine\Website\DataSources\Projects::class),
+ service(EntityManagerInterface::class),
+ ])
+ ->tag('doctrine.website.db_prefill');
+
+ $services->set('doctrine.website.data_sources.db_prefill.partners', Partners::class)
+ ->args([
+ inline_service(ArrayDataSource::class)
+ ->args(['%doctrine.website.partners%']),
+ service(EntityManagerInterface::class),
+ ])
+ ->tag('doctrine.website.db_prefill');
+
+ $services->set(MainExtension::class)
+ ->tag('twig.extension');
+
+ $services->set(Guides::class);
+
+ $services->set(GuidesParser::class)
+ ->public();
+
+ $services->set(RSTBuilder::class)
+ ->args(['$builder' => service(Guides::class)]);
+
+ $services->set(EventDispatcherInterface::class, EventDispatcher::class);
+
+ $services->set(HtmlResolver::class)
+ ->tag('phpdoc.guides.reference_resolver');
+
+ $services->set(GlobMenuFixerTransformer::class)
+ ->tag('phpdoc.guides.compiler.nodeTransformers');
+
+ $services->set(SidebarTransformer::class)
+ ->tag('phpdoc.guides.compiler.nodeTransformers');
+
+ $services->set(GuidesRstConverter::class)
+ ->args(['$nodeRenderer' => service('page_renderer')]);
+
+ $services->set(GuidesMarkdownConverter::class)
+ ->args(['$nodeRenderer' => service('page_renderer')]);
+
+ $services->set('page_renderer', TemplateNodeRenderer::class)
+ ->args([
+ '$template' => 'website-document.html.twig',
+ '$nodeClass' => DocumentNode::class,
+ ]);
+
+ $services->alias(LoggerInterface::class, 'logger');
+
+ $services->set('logger', Logger::class)
+ ->args(['$name' => 'docs'])
+ ->call('pushHandler', [service(StreamHandler::class)]);
+
+ $services->set(StreamHandler::class)
+ ->args(['php://stderr']);
+};
diff --git a/config/services.xml b/config/services.xml
deleted file mode 100644
index 6d21a79..0000000
--- a/config/services.xml
+++ /dev/null
@@ -1,247 +0,0 @@
-
-
-
-
-
-
-
-
-
- %doctrine.website.root_dir%
- %doctrine.website.env%
- %doctrine.website.projects_dir%
- %doctrine.website.docs_dir%
- %doctrine.website.source_dir%
- %doctrine.website.projects_data%
- %doctrine.website.webpack_build_dir%
- %doctrine.website.project_integration.types%
- https://packagist.org/packages/%s.json
-
- %doctrine.website.templates_dir%
- %doctrine.website.routes%
-
-
-
-
-
-
-
-
-
-
-
-
- /\/api\//
-
-
-
-
- %doctrine.website.templates_dir%
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- %doctrine.website.github.http_token%
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0
- %doctrine.website.cache_dir%/fscache
-
-
- %doctrine.website.send_grid.api_key%
-
-
-
-
- %doctrine.website.algolia.app_id%
- %doctrine.website.algolia.admin_api_key%
-
-
-
- %doctrine.website.title%
- %doctrine.website.subtitle%
- %doctrine.website.url%
- %doctrine.website.keywords%
- %doctrine.website.description%
- %doctrine.website.env%
- %doctrine.website.google_analytics_tracking_id%
- %doctrine.website.assets_url%
-
-
-
-
- Doctrine\Website\Model\BlogPost
-
-
-
-
- Doctrine\Website\Model\DoctrineUser
-
-
-
-
- Doctrine\Website\Model\Partner
-
-
-
-
- Doctrine\Website\Model\Project
-
-
-
-
-
- Doctrine\Website\Model\DoctrineUser
-
-
- %doctrine.website.doctrine_users%
-
-
-
-
-
-
-
- Doctrine\Website\Model\SitemapPage
-
-
-
-
-
-
- Doctrine\Website\Model\BlogPost
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- %doctrine.website.partners%
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- website-document.html.twig
- phpDocumentor\Guides\Nodes\DocumentNode
-
-
-
-
- docs
-
-
-
-
-
- STDERR
-
-
-
diff --git a/config/services/orm.php b/config/services/orm.php
new file mode 100644
index 0000000..72c4a9d
--- /dev/null
+++ b/config/services/orm.php
@@ -0,0 +1,35 @@
+services();
+ $parameters = $container->parameters();
+
+ $services->set(Configuration::class)
+ ->args([['lib/Model', 'lib/Git', 'lib/Docs/RST']])
+ ->factory([ORMSetup::class, 'createAttributeMetadataConfiguration'])
+ ->call('enableNativeLazyObjects', [true]);
+
+ $services->set(Connection::class)
+ ->args([['driver' => 'pdo_sqlite', 'path' => '%doctrine.website.cache_dir%/doctrine-website.sqlite']])
+ ->factory([DriverManager::class, 'getConnection']);
+
+ $services->set(EntityManager::class)
+ ->args([
+ service(Connection::class),
+ service(Configuration::class),
+ ]);
+
+ $services->alias(EntityManagerInterface::class, EntityManager::class)
+ ->public();
+};
diff --git a/config/services/orm.xml b/config/services/orm.xml
deleted file mode 100644
index 742592f..0000000
--- a/config/services/orm.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
- lib/Model
- lib/Git
- lib/Docs/RST
-
-
- true
-
-
-
-
-
-
- pdo_sqlite
- %doctrine.website.cache_dir%/doctrine-website.sqlite
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lib/Application.php b/lib/Application.php
index 18f3b7c..4d50827 100644
--- a/lib/Application.php
+++ b/lib/Application.php
@@ -22,7 +22,7 @@ use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
+use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use function assert;
@@ -98,8 +98,8 @@ final readonly class Application
$container->loadFromExtension($extension->getAlias());
}
- $xmlConfigLoader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../config'));
- $xmlConfigLoader->load('services.xml');
+ $xmlConfigLoader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../config'));
+ $xmlConfigLoader->load('services.php');
$yamlConfigLoader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../config'));
$yamlConfigLoader->load('routes.yml');