Title: Can't use primary keys that aren't auto-increment int · Issue #6 · parable-php/orm · GitHub
Open Graph Title: Can't use primary keys that aren't auto-increment int · Issue #6 · parable-php/orm
X Title: Can't use primary keys that aren't auto-increment int · Issue #6 · parable-php/orm
Description: For example, wanting to use UUID v6 as a primary key. What happens when you set up your entities and repositories appropriately for this? Well, it almost works, but then it breaks. Due to the way parable-php/orm is written, for inserts, ...
Open Graph Description: For example, wanting to use UUID v6 as a primary key. What happens when you set up your entities and repositories appropriately for this? Well, it almost works, but then it breaks. Due to the way p...
X Description: For example, wanting to use UUID v6 as a primary key. What happens when you set up your entities and repositories appropriately for this? Well, it almost works, but then it breaks. Due to the way p...
Opengraph URL: https://github.com/parable-php/orm/issues/6
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Can't use primary keys that aren't auto-increment int","articleBody":"For example, wanting to use UUID v6 as a primary key. What happens when you set up your entities and repositories appropriately for this? Well, it _almost_ works, but then it breaks.\r\n\r\nDue to the way parable-php/orm is written, for inserts, the primary key is always removed from the value set, to allow the sql flavor you're using to auto-generate it. Which, obviously, is a terrible idea when you're using custom primary keys.\r\n\r\nThere's multiple ways of approaching a fix for this, which is either specific about fixing custom primary keys, or offers a more generic way of tying into the insert process (perhaps even update, delete?).\r\n\r\nSpecific: Introduce `HasCustomPrimaryKey` and skip the id auto-removal upon insert if set.\r\nGeneric: Introduce `beforeInsert(array $values)` and possibly more. If implemented, would it just skip the default logic?\r\n\r\nWhat if both?\r\n\r\n```\r\ninterface HasCustomPrimaryKey {\r\n protected function beforeInsert(array $values): array;\r\n}\r\n```","author":{"url":"https://github.com/devvoh","@type":"Person","name":"devvoh"},"datePublished":"2022-04-16T08:12:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/6/orm/issues/6"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8e386e1f-2b4e-9b59-6f9e-b3e9631ffc4f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8DD0:124C11:7589F:94994:698D46BF |
| html-safe-nonce | ec0800171a677423a713f1aca94c9bec0f01355e5afa070a9d910ad3fefbf471 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4REQwOjEyNEMxMTo3NTg5Rjo5NDk5NDo2OThENDZCRiIsInZpc2l0b3JfaWQiOiI4MDA2NjEzNTQ2MDQwMTE2OTI3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 69ce7a19a1fc1fc149122f3fa22cd94253bcfd7f4b09aa092c2a57e3a8380666 |
| hovercard-subject-tag | issue:1206051249 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/parable-php/orm/6/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bc18c2ac68b6cfb8e6a6b68401037005eaf39dd01d2c9479aff534a2a5e74796/parable-php/orm/issues/6 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bc18c2ac68b6cfb8e6a6b68401037005eaf39dd01d2c9479aff534a2a5e74796/parable-php/orm/issues/6 |
| og:image:alt | For example, wanting to use UUID v6 as a primary key. What happens when you set up your entities and repositories appropriately for this? Well, it almost works, but then it breaks. Due to the way p... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | devvoh |
| hostname | github.com |
| expected-hostname | github.com |
| None | c0818105fa276287e9369cfdefa0a0fa7953719791ceff9b94d69623c0a4fe8a |
| turbo-cache-control | no-preview |
| go-import | github.com/parable-php/orm git https://github.com/parable-php/orm.git |
| octolytics-dimension-user_id | 32196713 |
| octolytics-dimension-user_login | parable-php |
| octolytics-dimension-repository_id | 174686043 |
| octolytics-dimension-repository_nwo | parable-php/orm |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 174686043 |
| octolytics-dimension-repository_network_root_nwo | parable-php/orm |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bc912d4349851e5f32c76bbb213754e40947d7a6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width