[FEATURE] Support 'has*' for properties in ObjectAccess
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Reflection / ObjectAccess.php
index 915f36b..99c50c0 100644 (file)
@@ -127,6 +127,10 @@ class ObjectAccess {
                if (is_callable(array($subject, $getterMethodName))) {
                        return $subject->{$getterMethodName}();
                }
+               $getterMethodName = 'has' . ucfirst($propertyName);
+               if (is_callable(array($subject, $getterMethodName))) {
+                       return $subject->{$getterMethodName}();
+               }
                if (is_object($subject) && array_key_exists($propertyName, get_object_vars($subject))) {
                        return $subject->{$propertyName};
                }
@@ -238,6 +242,9 @@ class ObjectAccess {
                                if (substr($methodName, 0, 3) === 'get') {
                                        $declaredPropertyNames[] = lcfirst(substr($methodName, 3));
                                }
+                               if (substr($methodName, 0, 3) === 'has') {
+                                       $declaredPropertyNames[] = lcfirst(substr($methodName, 3));
+                               }
                        }
                }
                $propertyNames = array_unique($declaredPropertyNames);
@@ -320,6 +327,9 @@ class ObjectAccess {
                if (is_callable(array($object, 'get' . ucfirst($propertyName)))) {
                        return TRUE;
                }
+               if (is_callable(array($object, 'has' . ucfirst($propertyName)))) {
+                       return TRUE;
+               }
                if (is_callable(array($object, 'is' . ucfirst($propertyName)))) {
                        return TRUE;
                }