20
20
use Doctrine \DBAL \Schema \Synchronizer \SchemaSynchronizer ;
21
21
use Doctrine \DBAL \Schema \Synchronizer \SingleDatabaseSynchronizer ;
22
22
use Doctrine \DBAL \Types \Type ;
23
+ use Doctrine \DBAL \Types \Types ;
23
24
use Symfony \Component \Messenger \Exception \InvalidArgumentException ;
24
25
use Symfony \Component \Messenger \Exception \TransportException ;
25
26
@@ -119,6 +120,7 @@ public function send(string $body, array $headers, int $delay = 0): string
119
120
'available_at ' => '? ' ,
120
121
]);
121
122
123
+ $ useDeprecatedConstants = !class_exists (Types::class);
122
124
$ this ->executeQuery ($ queryBuilder ->getSQL (), [
123
125
$ body ,
124
126
json_encode ($ headers ),
@@ -129,8 +131,8 @@ public function send(string $body, array $headers, int $delay = 0): string
129
131
null ,
130
132
null ,
131
133
null ,
132
- Type::DATETIME ,
133
- Type::DATETIME ,
134
+ $ useDeprecatedConstants ? Type::DATETIME : Types:: DATETIME_MUTABLE ,
135
+ $ useDeprecatedConstants ? Type::DATETIME : Types:: DATETIME_MUTABLE ,
134
136
]);
135
137
136
138
return $ this ->driverConnection ->lastInsertId ();
@@ -168,8 +170,10 @@ public function get(): ?array
168
170
$ this ->executeQuery ($ queryBuilder ->getSQL (), [
169
171
$ now ,
170
172
$ doctrineEnvelope ['id ' ],
171
- ], [
173
+ ], ! class_exists (Types::class) ? [
172
174
Type::DATETIME ,
175
+ ] : [
176
+ Types::DATETIME_MUTABLE ,
173
177
]);
174
178
175
179
$ this ->driverConnection ->commit ();
@@ -278,9 +282,12 @@ private function createAvailableMessagesQueryBuilder(): QueryBuilder
278
282
$ redeliverLimit ,
279
283
$ now ,
280
284
$ this ->configuration ['queue_name ' ],
281
- ], [
285
+ ], ! class_exists (Types::class) ? [
282
286
Type::DATETIME ,
283
287
Type::DATETIME ,
288
+ ] : [
289
+ Types::DATETIME_MUTABLE ,
290
+ Types::DATETIME_MUTABLE ,
284
291
]);
285
292
}
286
293
@@ -314,20 +321,21 @@ private function getSchema(): Schema
314
321
{
315
322
$ schema = new Schema ([], [], $ this ->driverConnection ->getSchemaManager ()->createSchemaConfig ());
316
323
$ table = $ schema ->createTable ($ this ->configuration ['table_name ' ]);
317
- $ table ->addColumn ('id ' , Type::BIGINT )
324
+ $ useDeprecatedConstants = !class_exists (Types::class);
325
+ $ table ->addColumn ('id ' , !$ useDeprecatedConstants ? Type::BIGINT : Types::BIGINT )
318
326
->setAutoincrement (true )
319
327
->setNotnull (true );
320
- $ table ->addColumn ('body ' , Type::TEXT )
328
+ $ table ->addColumn ('body ' , ! $ useDeprecatedConstants ? Type:: TEXT : Types ::TEXT )
321
329
->setNotnull (true );
322
- $ table ->addColumn ('headers ' , Type::TEXT )
330
+ $ table ->addColumn ('headers ' , ! $ useDeprecatedConstants ? Type:: TEXT : Types ::TEXT )
323
331
->setNotnull (true );
324
- $ table ->addColumn ('queue_name ' , Type::STRING )
332
+ $ table ->addColumn ('queue_name ' , ! $ useDeprecatedConstants ? Type:: STRING : Types ::STRING )
325
333
->setNotnull (true );
326
- $ table ->addColumn ('created_at ' , Type::DATETIME )
334
+ $ table ->addColumn ('created_at ' , ! $ useDeprecatedConstants ? Type::DATETIME : Types:: DATETIME_MUTABLE )
327
335
->setNotnull (true );
328
- $ table ->addColumn ('available_at ' , Type::DATETIME )
336
+ $ table ->addColumn ('available_at ' , ! $ useDeprecatedConstants ? Type::DATETIME : Types:: DATETIME_MUTABLE )
329
337
->setNotnull (true );
330
- $ table ->addColumn ('delivered_at ' , Type::DATETIME )
338
+ $ table ->addColumn ('delivered_at ' , ! $ useDeprecatedConstants ? Type::DATETIME : Types:: DATETIME_MUTABLE )
331
339
->setNotnull (false );
332
340
$ table ->setPrimaryKey (['id ' ]);
333
341
$ table ->addIndex (['queue_name ' ]);
0 commit comments