Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use kernel.build_dir by default for proxy dir and metadata cache #1843

Merged
merged 5 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ private function addOrmSection(ArrayNodeDefinition $node): void
->defaultValue(! method_exists(ProxyFactory::class, 'resetUninitializedProxy'))
->info('Enables the new implementation of proxies based on lazy ghosts instead of using the legacy implementation')
->end()
->scalarNode('proxy_dir')->defaultValue('%kernel.cache_dir%/doctrine/orm/Proxies')->end()
->scalarNode('proxy_dir')->defaultValue('%kernel.build_dir%/doctrine/orm/Proxies')->end()
->scalarNode('proxy_namespace')->defaultValue('Proxies')->end()
->arrayNode('controller_resolver')
->canBeDisabled()
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/DoctrineExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ private function createMetadataCache(string $objectManagerName, ContainerBuilder
$cache = new Definition(ArrayAdapter::class);

if (! $container->getParameter('kernel.debug')) {
$phpArrayFile = '%kernel.cache_dir%' . sprintf('/doctrine/orm/%s_metadata.php', $objectManagerName);
$phpArrayFile = '%kernel.build_dir%' . sprintf('/doctrine/orm/%s_metadata.php', $objectManagerName);
$cacheWarmerServiceId = $this->getObjectManagerElementName(sprintf('%s_%s', $objectManagerName, 'metadata_cache_warmer'));

$container->register($cacheWarmerServiceId, DoctrineMetadataCacheWarmer::class)
Expand Down
2 changes: 1 addition & 1 deletion tests/CacheSchemaSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public function testSchemaSubscriberWiring(string $adapterId, string $subscriber
'kernel.debug' => false,
'kernel.bundles' => [],
'kernel.cache_dir' => sys_get_temp_dir(),
'kernel.build_dir' => sys_get_temp_dir(),
'kernel.environment' => 'test',
'kernel.runtime_environment' => '%%env(default:kernel.environment:APP_RUNTIME_ENV)%%',
'kernel.build_dir' => __DIR__ . '/../../../../', // src dir
'kernel.root_dir' => __DIR__ . '/../../../../', // src dir
'kernel.project_dir' => __DIR__ . '/../../../../', // src dir
'kernel.bundles_metadata' => [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1491,6 +1491,7 @@ private function getContainer(array $bundles): ContainerBuilder
'kernel.debug' => false,
'kernel.bundles' => $map,
'kernel.cache_dir' => sys_get_temp_dir(),
'kernel.build_dir' => sys_get_temp_dir(),
'kernel.environment' => 'test',
'kernel.root_dir' => __DIR__ . '/../../', // src dir
'kernel.project_dir' => __DIR__ . '/../../', // src dir
Expand Down
2 changes: 1 addition & 1 deletion tests/DependencyInjection/Compiler/IdGeneratorPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public function testRepositoryServiceWiring(): void
'kernel.debug' => false,
'kernel.bundles' => $bundles,
'kernel.cache_dir' => sys_get_temp_dir(),
'kernel.build_dir' => sys_get_temp_dir(),
'kernel.environment' => 'test',
'kernel.runtime_environment' => '%%env(default:kernel.environment:APP_RUNTIME_ENV)%%',
'kernel.build_dir' => __DIR__ . '/../../../../', // src dir
'kernel.root_dir' => __DIR__ . '/../../../../', // src dir
'kernel.project_dir' => __DIR__ . '/../../../../', // src dir
'kernel.bundles_metadata' => [],
Expand Down
5 changes: 3 additions & 2 deletions tests/DependencyInjection/DoctrineExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ public function testDependencyInjectionConfigurationDefaults(): void
$this->assertEquals(
[
new Reference('doctrine.orm.default_entity_manager'),
'%kernel.cache_dir%/doctrine/orm/default_metadata.php',
'%kernel.build_dir%/doctrine/orm/default_metadata.php',
],
$definition->getArguments(),
);
Expand All @@ -528,7 +528,7 @@ public function testDependencyInjectionConfigurationDefaults(): void
$this->assertEquals(PhpArrayAdapter::class, $definition->getClass());

$arguments = $definition->getArguments();
$this->assertSame('%kernel.cache_dir%/doctrine/orm/default_metadata.php', $arguments[0]);
$this->assertSame('%kernel.build_dir%/doctrine/orm/default_metadata.php', $arguments[0]);
$wrappedDefinition = $arguments[1];
$this->assertSame(ArrayAdapter::class, $wrappedDefinition->getClass());

Expand Down Expand Up @@ -1506,6 +1506,7 @@ private static function getContainer(array $bundles = ['YamlBundle'], string $ve
'kernel.bundles' => $map,
'kernel.bundles_metadata' => $metadataMap,
'kernel.cache_dir' => sys_get_temp_dir(),
'kernel.build_dir' => sys_get_temp_dir(),
'kernel.environment' => 'test',
'kernel.root_dir' => __DIR__ . '/../../', // src dir
]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">

<config>
<orm proxy-dir="%kernel.cache_dir%/doctrine" proxy-namespace="DCProxy" />
<orm proxy-dir="%kernel.build_dir%/doctrine" proxy-namespace="DCProxy" />
</config>
</srv:container>
2 changes: 1 addition & 1 deletion tests/LockStoreSchemaListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public function testLockStoreSchemaSubscriberWiring(array $config, int $expected
'kernel.debug' => false,
'kernel.bundles' => [],
'kernel.cache_dir' => sys_get_temp_dir(),
'kernel.build_dir' => sys_get_temp_dir(),
'kernel.environment' => 'test',
'kernel.runtime_environment' => '%%env(default:kernel.environment:APP_RUNTIME_ENV)%%',
'kernel.build_dir' => __DIR__ . '/../../../../', // src dir
'kernel.root_dir' => __DIR__ . '/../../../../', // src dir
'kernel.project_dir' => __DIR__ . '/../../../../', // src dir
'kernel.bundles_metadata' => [],
Expand Down
2 changes: 1 addition & 1 deletion tests/ServiceRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public function testRepositoryServiceWiring(): void
'kernel.debug' => false,
'kernel.bundles' => ['RepositoryServiceBundle' => RepositoryServiceBundle::class],
'kernel.cache_dir' => sys_get_temp_dir(),
'kernel.build_dir' => sys_get_temp_dir(),
'kernel.environment' => 'test',
'kernel.runtime_environment' => '%%env(default:kernel.environment:APP_RUNTIME_ENV)%%',
'kernel.build_dir' => __DIR__ . '/../../../../', // src dir
'kernel.root_dir' => __DIR__ . '/../../../../', // src dir
'kernel.project_dir' => __DIR__ . '/../../../../', // src dir
'kernel.bundles_metadata' => [],
Expand Down
1 change: 1 addition & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function createXmlBundleTestContainer(): ContainerBuilder
'kernel.debug' => false,
'kernel.bundles' => ['XmlBundle' => 'Fixtures\Bundles\XmlBundle\XmlBundle'],
'kernel.cache_dir' => sys_get_temp_dir(),
'kernel.build_dir' => sys_get_temp_dir(),
'kernel.environment' => 'test',
'kernel.root_dir' => __DIR__ . '/../../../../', // src dir
'kernel.project_dir' => __DIR__ . '/../../../../', // src dir
Expand Down
Loading