laminas/laminas-db

Fixed bug in comparison at AbstractTableGateway->executeInsert

Closed this issue · 2 comments

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/7217
User: @edsonhoraciojunior
Created On: 2015-02-13T20:13:11Z
Updated At: 2015-02-19T21:29:24Z
Body
When executeInsert is called, sometimes $insertState['table'] is string or Zend\Db\Sql\TableIdentifier, that also happens with $this->table.

I got to a case that $insertState['table'] is string and $this->table is Zend\Db\Sql\TableIdentifier and that isn't mapped so a Exception is always thrown.

Example:

$tableGateway = new \Zend\Db\TableGateway\TableGateway('table1', $dbAdapter);
$sql = new \Zend\Db\Sql\Sql($dbAdapter);

// Prepare a insert with select
$select = $sql->select('any_table');
$select->columns(array('column1', 'column2'));
$select->where('status' => 'active');

$insert = $sql->insert('table1');
$insert->columns(array('column1', 'column2'));
$insert->values($select); //could be $insert->select($select) too

$tableGateway->insertWith($insert); // this will call AbstractTableGateway->executeInsert


Comment

User: @sasezaki
Created On: 2015-02-14T06:36:59Z
Updated At: 2015-02-14T06:36:59Z
Body
@edsonhoraciojunior Could you add unit-test ?


Comment

User: @weierophinney
Created On: 2015-02-19T21:29:24Z
Updated At: 2015-02-19T21:29:24Z
Body
I'd like to schedule this for 2.4, but I need a test case, @edsonhoraciojunior



Originally posted by @GeeH at zendframework/zend-db#138

This package is considered feature-complete, and is now in security-only maintenance mode, following a decision by the Technical Steering Committee.
If you have a security issue, please follow our security reporting guidelines.
If you wish to take on the role of maintainer, please nominate yourself

If you are looking for an actively maintained package alternative, we recommend: