Question

CakePHP uses 'id' as primary key. How can I override this limitation.

I have data_base with primary key as doc_it, and I am using save() for updating the records.

I have check previous threads, but wasn't able to fix the issue.

Was it helpful?

Solution

You can mention below code in your Model

public $primaryKey = 'doc_it';

and then you can use $this->YourModel->id; in your controller to access the primary key.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top