CommandSchedulerBundle
CommandSchedulerBundle copied to clipboard
Error: String could not be parsed as XML
Hi,
haven't created a new schedule item for some time, I'm currently using Symfony 5.1.7 and some deprecation seems to break the reading of the commands. I get "String could not be parsed as XML" in vendor\jmose\command-scheduler-bundle\Service\CommandParser.php (line 87) I checked what is contained in $xml which comes from the function getCommands() in CommandParser.php and it does in fact contain the XML but preceded by this:
[php] User Deprecated: Not passing a connection provider as the first constructor argument is deprecated
[
"exception" => ErrorException {
#message: "User Deprecated: Not passing a connection provider as the first constructor argument is deprecated"
#code: 0
#file: "(...)\vendor\doctrine\dbal\lib\Doctrine\DBAL\Tools\Console\Command\RunSqlCommand.php"
#line: 44
#severity: E_USER_DEPRECATED
trace: {
(...)\vendor\doctrine\dbal\lib\Doctrine\DBAL\Tools\Console\Command\RunSqlCommand.php:44 { …}
(...)\var\cache\dev\ContainerVnKjyBp\getDoctrine_QuerySqlCommandService.php:24 {
ContainerVnKjyBp\getDoctrine_QuerySqlCommandService::do($container, $lazyLoad = true)
›
› $container->privates['doctrine.query_sql_command'] = $instance = new \Doctrine\Bundle\DoctrineBundle\Command\Proxy\RunSqlDoctrineCommand();
›
}
(...)\var\cache\dev\ContainerVnKjyBp\App_KernelDevDebugContainer.php:609 { …}
(...)\vendor\symfony\dependency-injection\Container.php:441 { …}
(...)\vendor\symfony\dependency-injection\Argument\ServiceLocator.php:40 { …}
(...)\vendor\symfony\console\CommandLoader\ContainerCommandLoader.php:45 { …}
(...)\vendor\symfony\console\Application.php:527 { …}
(...)\vendor\symfony\console\Application.php:723 { …}
(...)\vendor\symfony\framework-bundle\Console\Application.php:142 { …}
(...)\vendor\symfony\console\Descriptor\ApplicationDescription.php:91 { …}
(...)\vendor\symfony\console\Descriptor\ApplicationDescription.php:68 { …}
(...)\vendor\symfony\console\Descriptor\XmlDescriptor.php:97 { …}
(...)\vendor\symfony\console\Descriptor\XmlDescriptor.php:155 { …}
(...)\vendor\symfony\console\Descriptor\Descriptor.php:55 { …}
(...)\vendor\symfony\console\Helper\DescriptorHelper.php:65 { …}
(...)\vendor\symfony\console\Command\ListCommand.php:75 { …}
(...)\vendor\symfony\console\Command\Command.php:258 { …}
(...)\vendor\symfony\console\Application.php:938 { …}
(...)\vendor\symfony\framework-bundle\Console\Application.php:99 { …}
(...)\vendor\symfony\console\Application.php:266 { …}
(...)\vendor\symfony\framework-bundle\Console\Application.php:82 { …}
(...)\vendor\symfony\console\Application.php:142 { …}
(...)\vendor\jmose\command-scheduler-bundle\Service\CommandParser.php:68 { …}
(...)\vendor\jmose\command-scheduler-bundle\Form\Type\CommandChoiceType.php:37 { …}
(...)\vendor\symfony\form\ResolvedFormType.php:186 { …}
(...)\vendor\symfony\form\ResolvedFormType.php:97 { …}
(...)\vendor\symfony\form\Extension\DataCollector\Proxy\ResolvedTypeDataCollectorProxy.php:74 { …}
(...)\vendor\symfony\form\FormFactory.php:66 { …}
(...)\vendor\symfony\form\FormBuilder.php:94 { …}
(...)\vendor\symfony\form\FormBuilder.php:244 { …}
(...)\vendor\symfony\form\FormBuilder.php:195 { …}
(...)\vendor\symfony\form\FormFactory.php:28 { …}
(...)\vendor\symfony\framework-bundle\Controller\AbstractController.php:327 { …}
(...)\vendor\jmose\command-scheduler-bundle\Controller\DetailController.php:30 { …}
(...)\vendor\symfony\http-kernel\HttpKernel.php:157 { …}
(...)\vendor\symfony\http-kernel\HttpKernel.php:79 { …}
(...)\vendor\symfony\framework-bundle\Controller\AbstractController.php:147 { …}
(...)\vendor\jmose\command-scheduler-bundle\Controller\DetailController.php:53 { …}
(...)\vendor\symfony\http-kernel\HttpKernel.php:157 { …}
(...)\vendor\symfony\http-kernel\HttpKernel.php:79 { …}
(...)\vendor\symfony\http-kernel\Kernel.php:196 { …}
(...)\public\index.php:29 { …}
}
}
]
So it seems that the update to the latest Doctrine-Bundle (2.1) which I believe came with Symfony 5.1 is causing this deprecation error.
Anybody else getting this and knows how to fix this without force downgrading Doctrine to 1.x?
Did some more testing:
- Executing "console list --format=xml" from the console will not show the error.
- Adding ""doctrine/persistence": "^1"" to my composer.json and downgrading doctrine doesn't fix the issue (as suspected).
- Executing another command (instead of "list") in CommandParser will not show an error.
Adding this to your services.yaml will fix the issue:
doctrine.query_sql_command:
class: Doctrine\DBAL\Tools\Console\Command\RunSqlCommand
arguments:
- '@Doctrine\Bundle\DoctrineBundle\Dbal\ManagerRegistryAwareConnectionProvider'
tags:
- { name: console.command, command: doctrine:query:sql }
see here
@Knallcharge adding your service entry to services.yaml worked for me. Thank!