Accessibility check fix

This commit is contained in:
Dennis Eichhorn 2016-01-09 19:45:58 +01:00
parent 7c4a25db72
commit 309641f6fe

View File

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