Issue
I have an application I'm working on with Cake 3 and I've baked a bunch of things to get the lay of the land as I'm newer to Cake.
When going to the baked add view for one of my models, filling out the form and submitting, the entry is added to the database but the primary key is blank on the entry. I've been doing some research and in the table class for Cake, I know that it's supposed to be created during the save method. However, I haven't overridden save or anything like that, so I'm a little confused as to why it's not generating the ID field for the primary key.
I was hoping someone might be able to point me in the right direction towards some steps that might help me debug this. Thanks!
Solution
From the Cookbook 3.x:
Rather than using an auto-increment key as the primary key, you may also use
char(36)
. CakePHP will then use a unique 36 character UUID (Text::uuid
) whenever you save a new record using theTable::save()
method.
Try converting you id
field in your MySQL table from
VARCHAR(36)
to
CHAR(36)
Answered By - Inigo Flores
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.