Returns False on Validation for Access Modifier on generic PPModel object

- Fixes #171 Issue
This commit is contained in:
japatel
2014-12-08 11:01:41 -06:00
parent 95c097bc7b
commit 8bb80cb843

View File

@@ -26,8 +26,12 @@ class ModelAccessorValidator
if ($mode != 'disabled') {
//If the mode is disabled, bypass the validation
foreach (array('set' . $attributeName, 'get' . $attributeName) as $methodName) {
if (get_class($class) == "PayPal\\Common\\PPModel") {
// Silently return false on cases where you are using PPModel instance directly
return false;
}
//Check if both getter and setter exists for given attribute
if (!method_exists($class, $methodName)) {
elseif (!method_exists($class, $methodName)) {
//Delegate the error based on the choice
$className = is_object($class) ? get_class($class) : (string)$class;
$errorMessage = "Missing Accessor: $className:$methodName. Please let us know by creating an issue at https://github.com/paypal/PayPal-PHP-SDK/issues";