diff --git a/src/Sql/Insert.php b/src/Sql/Insert.php index 891f59906b..5c8129648e 100644 --- a/src/Sql/Insert.php +++ b/src/Sql/Insert.php @@ -160,7 +160,8 @@ public function getRawState($key = null) $rawState = [ 'table' => $this->table, 'columns' => array_keys($this->columns), - 'values' => array_values($this->columns) + 'values' => array_values($this->columns), + 'select' => $this->select ]; return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState; } diff --git a/test/Sql/InsertTest.php b/test/Sql/InsertTest.php index 22647de751..59bbf938d8 100644 --- a/test/Sql/InsertTest.php +++ b/test/Sql/InsertTest.php @@ -124,6 +124,16 @@ public function testEmptyArrayValues() $this->assertEquals([], $this->readAttribute($this->insert, 'columns')); } + /** + * @covers Zend\Db\Sql\Insert::select + */ + public function testSelectIncludedInRawState() + { + $select = new Select; + $this->insert->select($select); + $this->assertSame($select, $this->insert->getRawState('select')); + } + /** * @covers Zend\Db\Sql\Insert::prepareStatement */