mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°6281 - Rest API core/create key value is no more between quote
This commit is contained in:
@@ -1503,7 +1503,7 @@ abstract class DBObject implements iDisplay
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @return int|null
|
||||
* @return string|null
|
||||
*/
|
||||
public function GetKey()
|
||||
{
|
||||
@@ -2820,7 +2820,7 @@ abstract class DBObject implements iDisplay
|
||||
*
|
||||
* @param string $sTableClass
|
||||
*
|
||||
* @return bool|int false if nothing to persist (no change), new key value otherwise
|
||||
* @return bool|string false if nothing to persist (no change), new key value otherwise
|
||||
* @throws \CoreException
|
||||
* @throws \MySQLException
|
||||
*/
|
||||
@@ -2903,7 +2903,7 @@ abstract class DBObject implements iDisplay
|
||||
if (empty($this->m_iKey))
|
||||
{
|
||||
// Take the autonumber
|
||||
$this->m_iKey = $iNewKey;
|
||||
$this->m_iKey = "$iNewKey";
|
||||
}
|
||||
return $this->m_iKey;
|
||||
}
|
||||
@@ -3055,7 +3055,7 @@ abstract class DBObject implements iDisplay
|
||||
* @api
|
||||
* @see DBWrite
|
||||
*
|
||||
* @return int|null inserted object key
|
||||
* @return string|null inserted object key
|
||||
*
|
||||
* @throws \ArchivedObjectException
|
||||
* @throws \CoreCannotSaveObjectException
|
||||
|
||||
@@ -520,7 +520,8 @@ class DBObjectTest extends ItopDataTestCase
|
||||
$oPerson = $this->CreatePersonInstance();
|
||||
|
||||
// Insert without Reload
|
||||
$oPerson->DBInsert();
|
||||
$key = $oPerson->DBInsert();
|
||||
$this->assertSame($key, $oPerson->GetKey());
|
||||
|
||||
// Get initial values
|
||||
$aValues1 = [];
|
||||
@@ -539,6 +540,9 @@ class DBObjectTest extends ItopDataTestCase
|
||||
|
||||
// 1st Reload
|
||||
$oPerson->Reload(true);
|
||||
// N°6281 - Rest API core/create key value is no more between quote
|
||||
$this->assertSame($key, $oPerson->GetKey());
|
||||
|
||||
$sPerson2 = print_r($oPerson, true);
|
||||
$this->assertNotEquals($sPerson1, $sPerson2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user