Open
Description
https://github.com/nette/database/blob/master/src/Database/Table/Selection.php#L742
$primaryKey = $this->context->getInsertId() aka PDO::lastInsertId()
you have table:
id int(10) unsigned NOT NULL
value varchar(255) COLLATE utf8_czech_ci DEFAULT NULL
PRIMARY KEY (id
),
Database::table()->insert(array('id'=>2, 'value'=> 'text'));
will result in
PDO::lastInsertId() return 0 because we have not autoincrement on the table
https://github.com/nette/database/blob/master/src/Database/Table/Selection.php#L769
$row = $this->createSelectionInstance()
->select('*')
->wherePrimary(0)
->fetch();
solution?
check no autoincrement on PK and then iterate over data to insert and get primary key value from this array?
Metadata
Metadata
Assignees
Labels
No labels