Skip to content
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

Merged
merged 6 commits into from Dec 25, 2019
Merged

REACH-updating credits #9060

merged 6 commits into from Dec 25, 2019

Conversation

@gotlieb
Copy link
Contributor

gotlieb commented Dec 24, 2019

root
@@ -52,4 +52,10 @@ public function hasObjectChanged($sourceObject)
{
return false;
}

public function validateForUpdate($sourceObject, $propertiesToSkip = array())

This comment has been minimized.

Copy link
@MosheMaorKaltura

MosheMaorKaltura Dec 25, 2019

Contributor

Is it needed?

{
return false;
}
return get_class($object) == 'kReoccurringVendorCredit';

This comment has been minimized.

Copy link
@MosheMaorKaltura

MosheMaorKaltura Dec 25, 2019

Contributor

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);

This comment has been minimized.

Copy link
@MosheMaorKaltura

MosheMaorKaltura Dec 25, 2019

Contributor

Brackets

*/
public function validateForUpdate($sourceObject, $propertiesToSkip = array())
{
if (!isMatchingCoreClass($sourceObject))

This comment has been minimized.

Copy link
@MosheMaorKaltura

MosheMaorKaltura Dec 25, 2019

Contributor
  1. This code cannot be called;
  2. 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())

This comment has been minimized.

Copy link
@MosheMaorKaltura

MosheMaorKaltura Dec 25, 2019

Contributor

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")));

This comment has been minimized.

Copy link
@MosheMaorKaltura

MosheMaorKaltura Dec 25, 2019

Contributor

String without processing - signle qoutes

return parent::toObject($dbObject, $propsToSkip);
}

public function hasObjectChanged($sourceObject)
{
if(parent::hasObjectChanged($sourceObject))
if (parent::hasObjectChanged($sourceObject))

This comment has been minimized.

Copy link
@MosheMaorKaltura

MosheMaorKaltura Dec 25, 2019

Contributor

brackets

{
return false;
}
return get_class($object) == 'kUnlimitedVendorCredit';

This comment has been minimized.

Copy link
@MosheMaorKaltura

MosheMaorKaltura Dec 25, 2019

Contributor

string matching

{
return false;
}
return get_class($object) == 'kVendorCredit';

This comment has been minimized.

Copy link
@MosheMaorKaltura

MosheMaorKaltura Dec 25, 2019

Contributor

string matching

root added 5 commits Dec 25, 2019
root
root
root
root
root
@gotlieb gotlieb merged commit 5d58f76 into Orion-15.14.0 Dec 25, 2019
2 checks passed
2 checks passed
Datree Smart Policy Best Practices Verification
Details
Datree insights datreeio insights events
Details
@MosheMaorKaltura

This comment has been minimized.

Copy link
Contributor

MosheMaorKaltura commented Dec 25, 2019

reveiwed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.