Tags: php-task/TaskBundle
Tags
Add Symfony 8 support (#64) * Add Symfony 8 support Widen Symfony version constraints in composer.json to allow ^8.0 across http-kernel, dependency-injection, expression-language, config, console, process, framework-bundle, finder, yaml and var-exporter. Symfony 8 removes XmlFileLoader support for DI service definitions. Convert all Resources/config/*.xml DI service files (and the test app's services.xml) to PHP ContainerConfigurator format, and switch TaskExtension and TestKernel from XmlFileLoader to PhpFileLoader. Doctrine ORM mapping XML files are untouched, as those use a separate XML driver unaffected by this removal. Bundle::build() gained a void return type in Symfony 8; add it to TaskBundle::build(). Doctrine ORM 3.4+ requires either PHP 8.4 native lazy objects or the legacy VarExporter-based lazy ghost proxies, the latter of which was removed from Symfony 8's ProxyHelper. Enable native lazy objects in the test app's doctrine config when running on PHP 8.4+, since Symfony 8 requires PHP 8.2+ and native lazy objects are the only supported option once VarExporter's generateLazyGhost() is gone on PHP 8.4. Fix a PHP 8.4 deprecation in DebugTasksCommand where round() could receive null when a task execution has no duration yet. * Guard enable_native_lazy_objects on doctrine-bundle < 2.15 The doctrine.orm.enable_native_lazy_objects config option was only added in doctrine/doctrine-bundle 2.15, which requires PHP >= 8.1. On the PHP 8.0 test job, Composer resolves an older doctrine-bundle that doesn't recognise this key, so the test app's Doctrine schema creation step failed with: Unrecognized option "enable_native_lazy_objects" under "doctrine.orm.entity_managers.default". Move the option into a separate config file that TestKernel only loads when the installed doctrine-bundle version actually supports it, detected via Composer\InstalledVersions. This keeps native lazy objects enabled on PHP 8.4+ with modern doctrine-bundle, without breaking older doctrine-bundle installs resolved on PHP 8.0/8.1. * Update composer doctrine dependencies * Update PHP 8.5 * Add missing return types for Symfony 8 compatibility Symfony 8 hardens several DependencyInjection interfaces with strict return types. Add matching return types to TaskExtension and HandlerCompilerPass so their declarations stay compatible: - TaskExtension::getConfiguration(): ?ConfigurationInterface - TaskExtension::load(): void - TaskExtension::prepend(): void - HandlerCompilerPass::process(): void Without these, PHP raises a fatal 'Declaration ... must be compatible with ...' error on Symfony 8. * Fix test app for Symfony 8 and Doctrine Bundle 3 compatibility Symfony\Component\Console\Application::add() was removed in Symfony 8.0 in favour of addCommand(); use addCommand() when available and fall back to add() on older Symfony versions. doctrine/doctrine-bundle 3.0 removed the 'doctrine.orm.auto_generate_proxy_classes' config option, so only load it for older doctrine-bundle versions, the same way enable_native_lazy_objects is already guarded for newer ones. The test app registered DoctrineBundle unconditionally, even for the 'array' storage config which never loads any 'doctrine' extension config. On doctrine-bundle 3.x this made the container compilation fail with 'You have requested a non-existent parameter doctrine.dbal.connection_factory.types', since RegisterDbalTypePass now runs unconditionally for any registered DoctrineBundle. Only register DoctrineBundle when the 'doctrine' storage is selected. --------- Co-authored-by: Alexander Schranz <alexander@sulu.io>
Allow console commands to be lazy loaded (#61) Add command names to console command definitions to allow lazy loading. Without this I was finding the DoctrineMetadataCacheWarmer was borking because it was not the first cache warmer to run, because these commands could not be lazy loaded due to the missing attribute.
Disable automapping and adding explicit entity config (#59) * Disabling automapping and adding explicit entity config * Disable automapping * Apply suggestions from code review Co-authored-by: Alexander Schranz <alexander@sulu.io> --------- Co-authored-by: Alexander Schranz <alexander@sulu.io>
PreviousNext