Bugfix if object already exists

This commit is contained in:
Dennis Eichhorn 2017-09-05 15:30:57 +02:00 committed by GitHub
parent 820f079ca4
commit 4fed8e5a46

View File

@ -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