ZF2-208: unable to get last insert id

Description

the doc doesn't say a thing about thins but it seems that

$result = $adapter->createStatement("INSERT INTO table (field) VALUES ('test')")->execute(); $result->getResource()->getLastGeneratedId();

throws an error

Comments

If somebody has to do work on this any way, maybe it is worth considering using a query to LAST_INSERT_ID() on Mysql adapters by default and make use of PHP function "mysql_insert_id" configurable.

This would make "getLastGeneratedId()" BIGINT-tolerant by default.

Fixed in master, please try this:


$adapter->getDriver()->getLastGeneratedValue();