Skip to content

Commit 5ead00b

Browse files
committed
Don't load data row if get Pk
1 parent db715df commit 5ead00b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/DbRow.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ public function _dbLoadIfNotLoaded(): void
219219
*/
220220
public function get(string $var)
221221
{
222-
$this->_dbLoadIfNotLoaded();
222+
if (!isset($this->primaryKeys[$var])) {
223+
$this->_dbLoadIfNotLoaded();
224+
}
223225

224226
return $this->dbRow[$var] ?? null;
225227
}
@@ -445,7 +447,7 @@ public function _getPrimaryKeys(): array
445447

446448
/**
447449
* Sets the values of the primary key.
448-
* This is set when the object is in "loaded" state.
450+
* This is set when the object is in "loaded" or "not loaded" state.
449451
*
450452
* @param mixed[] $primaryKeys
451453
*/

0 commit comments

Comments
 (0)