Skip to content

Instantly share code, notes, and snippets.

@SmellyFish
Created December 12, 2014 00:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SmellyFish/4e74971887114d8cc361 to your computer and use it in GitHub Desktop.
Save SmellyFish/4e74971887114d8cc361 to your computer and use it in GitHub Desktop.
protected function createInfluenceObject($accountId, $opportunityId, $touchId, $prospectId, $campaignId,
$touchCreatedAt, $oppCreatedAt, $oppIsClosed, $oppClosedAt, $influence = null)
{
if (empty($influence)) {
$influence = new \piOpportunityInfluence();
}
$influence->account_id = $accountId;
$influence->opportunity_id = $opportunityId;
$influence->campaign_touch_id = $touchId;
$influence->prospect_id = $prospectId;
$influence->campaign_id = $campaignId;
$influence->opportunity_created_at = $oppCreatedAt;
$influence->opportunity_closed_at = $oppIsClosed ? $oppClosedAt : null;
$influence->opportunity_influence_to_creation = strtotime($oppCreatedAt) - strtotime($touchCreatedAt);
if ($oppIsClosed) {
$influence->opportunity_influence_to_closed = strtotime($oppClosedAt) - strtotime($touchCreatedAt);
} else {
$influence->opportunity_influence_to_closed = null;
}
return $influence;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment