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

CakePHP 1.3.0, mysqli

I have a Manifest model, whose identifier must be a unique number from the printed form. However, when Manifest.id is set as the primary key, CakePHP helps me by setting auto-increment in the field. Is there a way to mark a field through schema.php and / or elsewhere to disable auto-increment? I need a simple plain old key without it.

The only other solution I can imagine is to add a separate manifest number field and change the foreign keys in half a dozen other tables. A little wasteful and less intuitive.

+3
source share
4 answers

, .

, , - id , . , post , 200 (, - ).

$this->data['Manifest']['id'] = 200;

, , id, ?

+2

. , CakePHP .

echo $this->Form->input('id', array('type' => 'text'));
+2

. , ( ). , , , . .

mysql? , auto_increment, true ID? mysql ID , , ?

+2

Source: https://habr.com/ru/post/1747268/


All Articles