From 309641f6fe00ebb2bb30ec0de2df0416df2b675e Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 9 Jan 2016 19:45:58 +0100 Subject: [PATCH] Accessibility check fix --- DataStorage/Database/DataMapperAbstract.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/DataStorage/Database/DataMapperAbstract.php b/DataStorage/Database/DataMapperAbstract.php index 2d4227a9b..696d74403 100644 --- a/DataStorage/Database/DataMapperAbstract.php +++ b/DataStorage/Database/DataMapperAbstract.php @@ -272,11 +272,20 @@ abstract class DataMapperAbstract implements DataMapperInterface foreach (static::$hasMany as $member => $rel) { /* is a has many property */ $property = $reflectionClass->getProperty($member); // throws ReflectionException + + if(!($isPublic = $property->isPublic())) { + $property->setAccessible(true); + } + $values = $property->getValue($obj); $temp = end($values); reset($values); $pname = $property->getName(); + if(!($isPublic)) { + $property->setAccessible(false); + } + if (is_object($temp)) { // todo: only create if object doesn't exists... get primaryKey field, then get member name based on this // now check if id is null or set.