Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eec12ec

Browse filesBrowse files
Use the driverConnection executeUpdate method
1 parent a2c2393 commit eec12ec
Copy full SHA for eec12ec

File tree

1 file changed

+21
-2
lines changed
Filter options

1 file changed

+21
-2
lines changed

‎src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php
+21-2Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function send(string $body, array $headers, int $delay = 0): string
126126
'available_at' => '?',
127127
]);
128128

129-
$this->executeQuery($queryBuilder->getSQL(), [
129+
$this->executeUpdate($queryBuilder->getSQL(), [
130130
$body,
131131
json_encode($headers),
132132
$this->configuration['queue_name'],
@@ -179,7 +179,7 @@ public function get(): ?array
179179
->set('delivered_at', '?')
180180
->where('id = ?');
181181
$now = new \DateTime();
182-
$this->executeQuery($queryBuilder->getSQL(), [
182+
$this->executeUpdate($queryBuilder->getSQL(), [
183183
$now,
184184
$doctrineEnvelope['id'],
185185
], [
@@ -329,6 +329,25 @@ private function executeQuery(string $sql, array $parameters = [], array $types
329329
return $stmt;
330330
}
331331

332+
private function executeUpdate(string $sql, array $parameters = [], array $types = [])
333+
{
334+
try {
335+
$stmt = $this->driverConnection->executeUpdate($sql, $parameters, $types);
336+
} catch (TableNotFoundException $e) {
337+
if ($this->driverConnection->isTransactionActive()) {
338+
throw $e;
339+
}
340+
341+
// create table
342+
if ($this->autoSetup) {
343+
$this->setup();
344+
}
345+
$stmt = $this->driverConnection->executeUpdate($sql, $parameters, $types);
346+
}
347+
348+
return $stmt;
349+
}
350+
332351
private function getSchema(): Schema
333352
{
334353
$schema = new Schema([], [], $this->driverConnection->getSchemaManager()->createSchemaConfig());

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.