CakePHP: How can I disable auto-increment on Model.id?

Posted by tomws on Stack Overflow See other posts from Stack Overflow or by tomws
Published on 2010-05-26T21:39:19Z Indexed on 2010/05/26 21:41 UTC
Read the original article Hit count: 185

Filed under:
|
|

CakePHP 1.3.0, mysqli

I have a model, Manifest, whose ID should be the unique number from a printed form. However, with Manifest.id set as the primary key, CakePHP is helping me by setting up auto-increment on the field. Is there a way to flag the field via schema.php and/or elsewhere to disable auto-increment? I need just a plain, old primary key without it.

The only other solution I can imagine is adding on a separate manifest number field and changing foreign keys in a half dozen other tables. A bit wasteful and not as intuitive.

© Stack Overflow or respective owner

Related posts about cakephp

Related posts about model