Updating ModelAccessValidator to be disabled if not set explicitly

- Disabled if not set
- A better debug message
This commit is contained in:
Jay Patel
2015-02-26 23:08:48 -06:00
parent 3e43f93f9b
commit 38d9758113
3 changed files with 5 additions and 4 deletions

1
.gitignore vendored
View File

@@ -18,3 +18,4 @@ composer.lock
# Project
var
tools

View File

@@ -23,7 +23,7 @@ class ModelAccessorValidator
public static function validate(PayPalModel $class, $attributeName)
{
$mode = PayPalConfigManager::getInstance()->get('validation.level');
if ($mode != 'disabled') {
if (!empty($mode) && $mode != 'disabled') {
//Check if $attributeName is string
if (gettype($attributeName) !== 'string') {
return false;
@@ -38,8 +38,8 @@ class ModelAccessorValidator
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";
PayPalLoggingManager::getInstance(__CLASS__)->warning($errorMessage);
$errorMessage = "Missing Accessor: $className:$methodName. You might be using older version of SDK. If not, create an issue at https://github.com/paypal/PayPal-PHP-SDK/issues";
PayPalLoggingManager::getInstance(__CLASS__)->debug($errorMessage);
if ($mode == 'strict') {
trigger_error($errorMessage, E_USER_NOTICE);
}

View File

@@ -51,7 +51,7 @@ log.LogLevel=INFO
; 'log' : logs the error message to logger only (default)
; 'strict' : throws a php notice message
; 'disable' : disable the validation
validation.level=log
validation.level=disable
;Caching Configuration
[cache]