No id returned on Insert


#1

Using the MSSQL driver, when inserting only the following is returned,

{"resource":[[]]}

Looks like the code here is not meeting the conditions to use the $builder->insertGetId(...) Laravel method in the vendor/dreamfactory/df-sqldb/src/Resources/Table.php file.

if (empty($id) && (1 === count($this->tableIdsInfo)) && $this->tableIdsInfo[0]->autoIncrement) {
    $idName = $this->tableIdsInfo[0]->name;
    $id[$idName] = $builder->insertGetId($parsed, $idName);
    $record[$idName] = $id[$idName];
} else {
    if (!$builder->insert($parsed)) {
        throw new InternalServerErrorException("Record insert failed.");
    }
}

Using dreamfactory version 2.1.2.


#2

There is a known issue that generates this response IF the id of the record is generated using a function (such a NEWID().)
If this is issue is present just generally (i.e. you manually create the record ID, or it’s an autoincrement INT) then this is fixed in later releases.


#3

Thanks for the info @drewpearce. Do you know which release this is fixed in?