Add with_constructor_extractor conditionally if symofony is >=7

This commit is contained in:
TheMilek 2026-03-25 10:08:31 +01:00 committed by Grzegorz Sadowski
parent 20e78ae3cd
commit 451d58bb07
No known key found for this signature in database
GPG key ID: EF87FF4E6E3BD364
2 changed files with 15 additions and 2 deletions

View file

@ -4,7 +4,5 @@ framework:
enabled: true
csrf_protection: true
http_method_override: true
property_info:
with_constructor_extractor: false
session:
handler_id: ~

View file

@ -27,6 +27,7 @@ use Sylius\Bundle\CoreBundle\Attribute\AsUriBasedSectionResolver;
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension;
use Sylius\Component\Core\Filesystem\Adapter\FilesystemAdapterInterface;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
@ -110,6 +111,7 @@ final class SyliusCoreExtension extends AbstractResourceExtension implements Pre
$this->prependHwiOauth($container);
$this->prependDoctrineMigrations($container);
$this->prependDoctrineIdentityGenerationPreferences($container);
$this->prependPropertyInfo($container);
}
protected function getMigrationsNamespace(): string
@ -152,6 +154,19 @@ final class SyliusCoreExtension extends AbstractResourceExtension implements Pre
]);
}
private function prependPropertyInfo(ContainerBuilder $container): void
{
if (version_compare(Kernel::VERSION, '7.0.0', '<')) {
return;
}
$container->prependExtensionConfig('framework', [
'property_info' => [
'with_constructor_extractor' => false,
],
]);
}
private function prependHwiOauth(ContainerBuilder $container): void
{
if (!$container->hasExtension('hwi_oauth')) {