How to deal with auto increment id and auto-generated UUID? #924
Replies: 1 comment 1 reply
-
I'm also wondering the same thing- it isn't clear (or mentioned at all really) in the docs how to handle this, and Lazy or Optional properties don't seem quite correct. I was hoping for some kind of "ignore on create" type of functionality where I can have a single Data object for all API CRUD operations. I feel like we're not better off (minus typescript generation which I don't use) by having to create a separate Data object for the creation request and a separate one for everything else (read, update). I noticed in the Laracon US demonstration, Freek was using two seperate Data objects for Flare's Project feature which I can only assume was for this exact reason but he never explained it. TL;DR: It just seems like the package is missing its own point if we're forced to create multiple DTO's for the same data just because of an auto-incrementing ID. @freekmurze maybe you could elaborate if this is the expected pattern? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Pardon my newbie question, it's the first time I'm using Data Objects so I'm still a bit confused.
I got a Site model with:
as well as the default auto-increment id.
My SiteData
As an example, I'm trying to make a seeder with the Data object:
And it works.
But as you can see above, I had to uncomment the id and the uuid field on the data object.
So I'm wondering if I should create a Data object for create and another one for update.
Or if I'm doing things completely wrong and I need your advice :)
Beta Was this translation helpful? Give feedback.
All reactions