Description
I have a Symfony 6.4 application and have an issue with enqueue.
My Symfony Database is a MSSQL Server.
I have installed the enqueue modules with composer. This worked fine. The table enqueue got created.
When I now try to save a command to the Queue, I get an error:
$cmd = new RunCommand('debug:container', ['--tag=form.type']);
$producer->sendCommand(Commands::RUN_COMMAND, $cmd);
Error:
[Doctrine\DBAL\Exception\DriverException (-16)]
An exception occurred while executing a query: SQLSTATE [IMSSP, -16]: An invalid PHP type for parameter 1 was specified
While debugging I found out that parameter 1 of the error is the id
field of the database.
The Id is set at L69 https://github.com/php-enqueue/dbal/blob/2375961434e2a69b8710875f1c4e56f01b348a47/DbalProducer.php#L69 with Uuid:uuid4() function. 'id' => Uuid::uuid4(),
It returns an object for id
:
Array
(
[id] => Ramsey\Uuid\Lazy\LazyUuidFromString Object
(
[unwrapped:Ramsey\Uuid\Lazy\LazyUuidFromString:private] =>
[uuid:Ramsey\Uuid\Lazy\LazyUuidFromString:private] => 5909c9e3-1690-4cd0-b0f0-0151e6f7996a
)
[published_at] => 17252753310188
// [body] =>... more fields of enqueue table
)
When I change now L69 to 'id' => \Enqueue\Util\UUID::generate()
, it returns the Uuid String and saving to database works.
Array
(
[id] => 6f9cfd8d-4f3a-4675-9f95-a2099de60457
[published_at] => 17252757497569
//[body] => ...
)
There seems to be an issue to convert the Object to an Uuid string somewhere later or it is only MSSQL related.
Can you please check, if you can reproduce this issue?
Does anyone know a solution for this problem?