php-enqueue / enqueue-dev

Message Queue, Job Queue, Broadcasting, WebSockets packages for PHP, Symfony, Laravel, Magento. DEVELOPMENT REPOSITORY - provided by Forma-Pro
https://enqueue.forma-pro.com/
MIT License
2.17k stars 429 forks source link

Update uuid DbalProducer.php #1346

Open KrisHarris opened 4 months ago

KrisHarris commented 4 months ago

From this thread https://github.com/ramsey/uuid/issues/327 ramsey/uuid 4.1 introduced Ramsey\Uuid\Lazy\LazyUuidFromString object which is used over the original Ramsey\Uuid\Uuid object when generating Uuids (I.E. when using Uuid::uuid4()).

This causes conversion issues when using the objects on inserting records. But can simply use toString() from UuidInterface to convert to actual guid (string) when calling DBAL insert.

The change means that 'id' => DbalType::GUID on parameter types array is correct, rather than throwing:

Doctrine\DBAL\Exception\DriverException: An exception occurred while executing a query: SQLSTATE [IMSSP, -16]: An invalid PHP type for parameter 1 was specified.

This change is BC, tested with ramsey/uuid:3.9.7 and ramsey/uuid:4.7.5