Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

SequenceFeature doesn't set lastInsertValue correctly #142

Closed
@GeeH

Description

@GeeH

This issue has been moved from the zendframework repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html


Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7689
User: @tiptone
Created On: 2016-03-17T19:23:50Z
Updated At: 2016-06-28T12:45:52Z
Body
In the file Module.php:

$dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
$featureSet = new FeatureSet();
$featureSet->addFeature(new Feature\SequenceFeature('ID','SEQNAME'));
$resultSetPrototype = new ResultSet();
$resultSetPrototype->setArrayObjectPrototype(new ModeledObject());
return new TableGateway('TABLENAME', $dbAdapter, $featureSet, $resultSetPrototype);

In the file ModelTable.php

$this->tableGateway->insert($data);
$id = $this->tableGateway->lastInsertValue;

Expected:
$id matches the value of TABLENAME.ID after insert.

Result:
$id is the value of TABLENAME.ID before the insert was done. TABLENAME.ID is always +1 higher than the value returned by lastInsertValue.


Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions