diff --git a/src/AmoCRM/EntitiesServices/Calls.php b/src/AmoCRM/EntitiesServices/Calls.php index 8e66f09f..c3d931a8 100644 --- a/src/AmoCRM/EntitiesServices/Calls.php +++ b/src/AmoCRM/EntitiesServices/Calls.php @@ -122,7 +122,7 @@ protected function processAction(BaseApiCollection $collection, array $response) */ protected function processModelAction(BaseApiModel $apiModel, array $entity): void { - /** @var ContactModel $apiModel */ + /** @var CallModel $apiModel */ if (isset($entity['id'])) { $apiModel->setId($entity['id']); } diff --git a/src/AmoCRM/Models/CallModel.php b/src/AmoCRM/Models/CallModel.php index cd7a1bc2..d491fcb1 100644 --- a/src/AmoCRM/Models/CallModel.php +++ b/src/AmoCRM/Models/CallModel.php @@ -2,6 +2,7 @@ namespace AmoCRM\Models; +use AmoCRM\Models\Interfaces\HasIdInterface; use AmoCRM\Models\Traits\CallTrait; use AmoCRM\Models\Traits\RequestIdTrait; @@ -10,11 +11,16 @@ * * @package AmoCRM\Models */ -class CallModel extends BaseApiModel +class CallModel extends BaseApiModel implements HasIdInterface { use CallTrait; use RequestIdTrait; + /** + * @var int|null + */ + protected $id; + /** * @var string|null */ @@ -44,6 +50,10 @@ public function fromArray(array $call): CallModel { $model = new static(); + if (isset($call['id'])) { + $this->setId($call['id']); + } + if (isset($call['uniq'])) { $this->setUniq($call['uniq']); } @@ -85,6 +95,7 @@ public function fromArray(array $call): CallModel public function toArray(): array { return [ + 'id' => $this->getId(), 'uniq' => $this->getUniq(), 'duration' => $this->getDuration(), 'source' => $this->getSource(), @@ -122,6 +133,26 @@ public function toApi(?string $requestId = "0"): array ]; } + /** + * @return int|null + */ + public function getId(): ?int + { + return $this->id; + } + + /** + * @param int $id + * + * @return CallModel + */ + public function setId(int $id): CallModel + { + $this->id = $id; + + return $this; + } + /** * @return string|null */