protected function createNewItem($item)
{
$arrData = array('tstamp' => $item->get('tstamp'));
$blnNewBaseItem = false;
if ($this->hasVariants()) {
// No variant group is given, so we have a complete new base item this should be a workaround for these
// values should be set by the GeneralDataMetaModel or whoever is calling this method.
if ($item->get('vargroup') === null) {
$item->set('varbase', '1');
$item->set('vargroup', '0');
$blnNewBaseItem = true;
}
$arrData['varbase'] = $item->get('varbase');
$arrData['vargroup'] = $item->get('vargroup');
}
/** @noinspection PhpUndefinedFieldInspection */
$intItemId = $this->getDatabase()->prepare('INSERT INTO ' . $this->getTableName() . ' %s')->set($arrData)->execute()->insertId;
$item->set('id', $intItemId);
// Add the variant group equal to the id.
if ($blnNewBaseItem) {
$this->saveSimpleColumn('vargroup', array($item->get('id')), $item->get('id'));
}
}