No, that would be alright. It's a terrible idea, but technically you could just assign the user data to your id field, then save.
You would want to check first that you don't already have a record with that id, etc etc.. why are you reluctant to use a synthetic/auto incrementing key? Every time I've tried to use a real world value for a key, I've regretted it later. ;Daniel On Friday, 10 August 2012, Lightee wrote: > So, it seems that the value of the primary key cannot be inputted by user. > Is this correct? > > On Friday, August 10, 2012 4:02:25 PM UTC+8, Albert 'Tigr' wrote: >> >> AFAIK you have a choice of: >> >> - integer key that you set in your DB to be auto-incremented >> - UUID key that CakePHP will automatically generate for you >> - any other key that you generate yourself before saving >> >> HTH >> Albert >> >> On Thursday, August 9, 2012 9:59:44 AM UTC+2, Lightee wrote: >>> >>> Dear CakePHP gurus, >>> >>> I am using cakephp scaffolding feature to build a basic CRUD >>> application. I have a table which gives problem when adding new record. I >>> discover that the reason is that the primary key is not auto-incremented. >>> May I know whether this is part of CakePHP convention that primary key has >>> to be auto-incremented? >>> >>> Other tables with primary keys which are auto-incremented do not give me >>> problems. >>> >> -- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to > [email protected]<javascript:_e({}, 'cvml', > '[email protected]');> > . > To unsubscribe from this group, send email to > [email protected] <javascript:_e({}, 'cvml', > 'cake-php%[email protected]');>. > Visit this group at http://groups.google.com/group/cake-php?hl=en-US. > > > -- Daniel Baird I've tried going to the XHTML <bar /> a few times, but it's always closed. -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
