Skip to content

Commit

Permalink
Merge pull request #74 from amocrm/hotfix/issue#67
Browse files Browse the repository at this point in the history
fix changed request
  • Loading branch information
bessudnov authored Jul 13, 2020
2 parents 396d7fd + ccafda3 commit 63ee7c9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/AmoCRM/Models/Unsorted/BaseUnsortedModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ public function toArray(): array
$result['lead'] = $this->getLead()->toArray();
}

if (!is_null($this->getLead())) {
$result['leads'] = [$this->getLead()->toArray()];
}

if (!is_null($this->getCompanies())) {
$result['companies'] = $this->getCompanies()->toArray();
}
Expand Down Expand Up @@ -408,7 +412,7 @@ public function toApi(?string $requestId = "0"): array
$requestId = $this->getRequestId();

if (!is_null($this->getLead())) {
$result[AmoCRMApiRequest::EMBEDDED]['lead'] = $this->getLead()->toApi($requestId);
$result[AmoCRMApiRequest::EMBEDDED]['leads'] = [$this->getLead()->toApi($requestId)];
}

if (!is_null($this->getCompanies())) {
Expand Down

0 comments on commit 63ee7c9

Please sign in to comment.