I have made custom module for that I have to change tables primary key due to some reasons.I have updated it in Model\Resource\Modelclass.php file , flush cache including "Flush Cache Storage" of cache management.

But enable to save data in db.

It shows properly the saved module and its id by 1.)

$saved_obj = $model->save();
echo'<pre>';print_r($saved_obj->getData()); exit; 


$insertid = $model->save()->getId();
echo'<pre>';print_r($insertid); //exit();

1 Answer 1


I have found my problem's answer in comment's of below question Magento model->save() doesnt working by OSdave.

As i have changed the pk but my one is not auto incremental so i have to specify to the model resource's construct that $this->_isPkAutoIncrement = false;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.