Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Return value in Database::table()->insert() without autoincrement on PK #41

insekticid opened this issue Nov 7, 2014 · 1 comment


Copy link

@insekticid insekticid commented Nov 7, 2014

$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

Database::table()->insert(array('id'=>2, 'value'=> 'text'));
will result in
PDO::lastInsertId() return 0 because we have not autoincrement on the table

$row = $this->createSelectionInstance()

check no autoincrement on PK and then iterate over data to insert and get primary key value from this array?


This comment has been minimized.

Copy link

@dg dg commented Mar 26, 2015

Can you prepare PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.