src/MetaModel.php
protected function createNewItem($item)
    {
        $data      = ['tstamp' => $item->get('tstamp')];
        $isNewItem = 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');
                $isNewItem = true;
            }
            $data['varbase']  = $item->get('varbase');
            $data['vargroup'] = $item->get('vargroup');
        }

        $connection = $this->getConnection();
        $builder    = $connection->createQueryBuilder();
        $parameters = [];
        foreach (array_keys($data) as $key) {
            $parameters[$key] = ':' . $key;
        }
        $builder
            ->insert($this->getTableName())
            ->values($parameters)
            ->setParameters($data)
            ->execute();

        $item->set('id', $connection->lastInsertId());

        // Add the variant group equal to the id.
        if ($isNewItem) {
            $this->saveSimpleColumn('vargroup', [$item->get('id')], $item->get('id'));
        }
    }
protected function createNewItem($item)
    {
        $data      = ['tstamp' => $item->get('tstamp')];
        $isNewItem = 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');
                $isNewItem = true;
            }
            $data['varbase']  = $item->get('varbase');
            $data['vargroup'] = $item->get('vargroup');
        }

        $connection = $this->getConnection();
        $builder    = $connection->createQueryBuilder();
        $parameters = [];
        foreach (array_keys($data) as $key) {
            $parameters[$key] = ':' . $key;
        }
        $builder
            ->insert($this->getTableName())
            ->values($parameters)
            ->setParameters($data)
            ->execute();

        $item->set('id', $connection->lastInsertId());

        // Add the variant group equal to the id.
        if ($isNewItem) {
            $this->saveSimpleColumn('vargroup', [$item->get('id')], $item->get('id'));
        }
    }
Create a new item in the database.

@param IItem $item The item to be created.

@return void