- last update
10 months ago Patch Failed to Apply - last update
10 months ago 124 pass, 89 fail - last update
10 months ago 580 pass, 8 fail - last update
10 months ago 580 pass, 8 fail - Status changed to Needs review
10 months ago 2:05pm 7 September 2023 - Status changed to Needs work
10 months ago 2:06pm 7 September 2023 - πΊπΈUnited States bpizzillo
Previous patch hardcoded the table name and used
$this->connection->query
. For some reason this broke a large number of tests. Usingstatic::TABLE_NAME
and$this->connection->insert
does not seem to throw errors. Let's see if we can get a good build. - last update
10 months ago 610 pass - last update
10 months ago 124 pass, 89 fail - last update
10 months ago 610 pass - last update
10 months ago 610 pass - πΊπΈUnited States bpizzillo
Accidentally left in old use statement from previous patch.
- last update
10 months ago 610 pass - last update
10 months ago 610 pass - last update
10 months ago 610 pass - last update
10 months ago 610 pass - Status changed to Needs review
10 months ago 3:07am 8 September 2023 - Status changed to RTBC
5 months ago 4:03pm 27 January 2024 - π©πͺGermany marvin_B8
Looks pretty good so far, I just noticed the following things:
- unset the transaction should not be necessary (https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...)
- The logic for the id could be reversed.So that it looks something like this:
public function createItemMultiple(array $items) { // Wrap these in our own loop so we get the right ID values. $ids = []; $now = time(); $transaction = $this->connection->startTransaction(); try { foreach ($items as $data) { $id = $this->connection->insert(static::TABLE_NAME) ->fields([ 'data' => serialize($data), 'created' => $now, ])->execute(); if (empty($id)) { // This will trigger a rollback of the transaction. throw new \Exception('Inserted item did not return an ID'); } $ids[] = (int) $id; } } catch (\Exception $e) { $transaction->rollBack(); return FALSE; } return $ids; }
and If it's a performance problem, we can also think about putting the whole thing in a different queue.