-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
REACH-updating credits #9060
REACH-updating credits #9060
Conversation
@@ -52,4 +52,10 @@ public function hasObjectChanged($sourceObject) | |||
{ | |||
return false; | |||
} | |||
|
|||
public function validateForUpdate($sourceObject, $propertiesToSkip = array()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it needed?
{ | ||
return false; | ||
} | ||
return get_class($object) == 'kReoccurringVendorCredit'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String matching only with ===
if (isset($this->fromDate) && isset($this->toDate)) | ||
{ | ||
if ($this->fromDate > $this->toDate) | ||
throw new KalturaAPIException(KalturaReachErrors::INVALID_CREDIT_DATES, $this->fromDate, $this->toDate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brackets
*/ | ||
public function validateForUpdate($sourceObject, $propertiesToSkip = array()) | ||
{ | ||
if (!isMatchingCoreClass($sourceObject)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This code cannot be called;
- The function holds several case , break it to smaller cases.
/* @var $sourceObject kTimeRangeVendorCredit */ | ||
if($this->toDate && $this->toDate != $sourceObject->getToDate()) | ||
if ( method_exists($sourceObject,'getToDate') && $this->fromDate > $sourceObject->getToDate()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must be used based on object functions , method_exists is bad practice.
@@ -39,7 +39,7 @@ public function getMapBetweenObjects() | |||
public function validateForInsert($propertiesToSkip = array()) | |||
{ | |||
$this->validatePropertyNotNull("fromDate"); | |||
parent::validateForInsert(array("credit")); | |||
parent::validateForInsert(array_merge($propertiesToSkip,array("credit"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String without processing - signle qoutes
return parent::toObject($dbObject, $propsToSkip); | ||
} | ||
|
||
public function hasObjectChanged($sourceObject) | ||
{ | ||
if(parent::hasObjectChanged($sourceObject)) | ||
if (parent::hasObjectChanged($sourceObject)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
brackets
{ | ||
return false; | ||
} | ||
return get_class($object) == 'kUnlimitedVendorCredit'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string matching
{ | ||
return false; | ||
} | ||
return get_class($object) == 'kVendorCredit'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string matching
reveiwed |
@MosheMaorKaltura
@yossipapi