0

Custom table created with name 'picklist_item' with 'item_id' column as primary key, in one of the admin controller action, collection object for 'picklist' table has been created and called getIdFieldName() but it is returning NULL, I am expecting it should return the primary key table column name.

1 Answer 1

0

You should initialize the property $_idFieldName with the value of the table primary key in the collection class associated with your table:

<Vendor>\<Module>\Model\ResourceModel\<ModelName>\Collection.php:

protected $_idFieldName = 'item_id';

See original answer to a similar question: https://magento.stackexchange.com/a/145363/31483

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.