From ccafda3593ff5eb11e53afbfaf3279a5ea8a6b5c Mon Sep 17 00:00:00 2001 From: Nikita Date: Mon, 13 Jul 2020 18:15:59 +0300 Subject: [PATCH] fix changed request --- src/AmoCRM/Models/Unsorted/BaseUnsortedModel.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/AmoCRM/Models/Unsorted/BaseUnsortedModel.php b/src/AmoCRM/Models/Unsorted/BaseUnsortedModel.php index d407200c..07891a97 100644 --- a/src/AmoCRM/Models/Unsorted/BaseUnsortedModel.php +++ b/src/AmoCRM/Models/Unsorted/BaseUnsortedModel.php @@ -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(); } @@ -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())) {