mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #8874 from johannesx75/fix-pdoconnector-generatedid-type-2
Fix PDOConnector GeneratedID return type
This commit is contained in:
commit
8483a9644c
@ -483,7 +483,7 @@ class PDOConnector extends DBConnector implements TransactionManager
|
||||
|
||||
public function getGeneratedID($table)
|
||||
{
|
||||
return $this->pdoConnection->lastInsertId();
|
||||
return (int) $this->pdoConnection->lastInsertId();
|
||||
}
|
||||
|
||||
public function affectedRows()
|
||||
|
@ -1925,6 +1925,17 @@ class DataObjectTest extends SapphireTest
|
||||
$this->assertEquals('1988-03-04 06:30:00', $obj->DatetimeField);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the autogenerated ID is returned as int
|
||||
*/
|
||||
public function testIDFieldTypeAfterInsert()
|
||||
{
|
||||
$obj = new DataObjectTest\Fixture();
|
||||
$obj->write();
|
||||
|
||||
$this->assertInternalType("int", $obj->ID);
|
||||
}
|
||||
|
||||
public function testTwoSubclassesWithTheSameFieldNameWork()
|
||||
{
|
||||
// Create two objects of different subclasses, setting the values of fields that are
|
||||
|
Loading…
Reference in New Issue
Block a user