id not present in _postSave

megabosx

Active member
I have added an override to the _postSave() method of the datawriter of my item. The problem i have is that at this stage it seems that the item id is not available yet, iv'e defined the id as array('type'=>self::TYPE_UINT, 'auto_Increment'=>true), in the getFields section. I expected the id to be available, any reason why it's not?

PHP:
protected function _postSave(){
    item = $this->getMergedData();
    item['id'];
}
 

truonglv

Formerly Nobita.Kun
autoIncrement not auto_Increment.

Also variable with item will receive throw runtime error. It is should be $item
 

Brogan

XenForo moderator
Staff member
The column in the table has likely been defined as auto_increment, if that's what you mean.
 
Top