Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] Extract insert all #105

Merged
merged 5 commits into from
May 29, 2024
Merged

[1.x] Extract insert all #105

merged 5 commits into from
May 29, 2024

Conversation

timacdonald
Copy link
Member

@timacdonald timacdonald commented May 29, 2024

This PR extracts an insertMany method to make extending the database driver easier.

Some of the community (#104 (comment), #100) are extending the driver to add custom fields to the features table. With the recent changes unique constraint handling (#104) we introduced a new insert query that is not able to be intercepted in an extended class.

This PR extracts the query out to an insertMany method to make it easier to intercept and decorate.

Additionally it:

  • Makes the existing insert method a proxy to the new insertMany method.
  • Fixes a minor typo in the exception message.
  • Adds some tests for the unique constraint handling.

@@ -222,7 +216,7 @@ public function get($feature, $scope): mixed
$this->insert($feature, $scope, $value);
} catch (UniqueConstraintViolationException $e) {
if ($this->retryDepth === 1) {
throw new RuntimeException('Unable to insert feature value from the database.', previous: $e);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo

@timacdonald timacdonald marked this pull request as ready for review May 29, 2024 00:28
@taylorotwell taylorotwell merged commit 46c0714 into 1.x May 29, 2024
7 checks passed
@taylorotwell taylorotwell deleted the extract-insert-all branch May 29, 2024 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants