diff --git a/DataStorage/Database/DataMapperAbstract.php b/DataStorage/Database/DataMapperAbstract.php index d117baba4..15eff51a9 100644 --- a/DataStorage/Database/DataMapperAbstract.php +++ b/DataStorage/Database/DataMapperAbstract.php @@ -1498,6 +1498,8 @@ class DataMapperAbstract implements DataMapperInterface foreach ($primaryKey as $key => $value) { if(self::isInitialized(static::class, $value)) { + $obj[$value] = self::getInitialized(static::class, $value); + continue; } @@ -1911,6 +1913,21 @@ class DataMapperAbstract implements DataMapperInterface { return isset(self::$initObjects[$mapper]) && isset(self::$initObjects[$mapper][$id]); } + + /** + * Get initialized object + * + * @param string $mapper Mapper name + * @param mixed $id Object id + * + * @return object + * + * @since 1.0.0 + */ + private static function getInitialized($mapper, $id) + { + return self::$initObjects[$mapper][$id]; + } /** * Define the highest mapper of this request