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

Ошибка при syncOne #144

Closed
ramik5 opened this issue Sep 22, 2020 · 0 comments · Fixed by #153
Closed

Ошибка при syncOne #144

ramik5 opened this issue Sep 22, 2020 · 0 comments · Fixed by #153
Labels
bug Something isn't working

Comments

@ramik5
Copy link

ramik5 commented Sep 22, 2020

Получаю ошибку при синхронизации модели
Fatal error: Uncaught TypeError: Argument 1 passed to AmoCRM\Models\CompanyModel::setTags() must be an instance of AmoCRM\Collections\TagsCollection, null given, called in

Возникает тогда, когда у компании отсутствуют теги. Аналогичная история когда у компании нет связанных контактов.

// Получим компанию сделки
if(($company = $lead->getCompany())) {
 
    // Засинхронизируем модель с amoCRM
    $company = $apiClient->companies()->syncOne($company);
}

Решается добавление ?TagsCollection вместо TagsCollection в AmoCRM\Models\CompanyModel

public function setTags(?TagsCollection $tags): self
    {
        $this->tags = $tags;

        return $this;
    }

Аналогичная история и по некоторым другим методам моделей:
AmoCRM\Models\CompanyModel,
AmoCRM\Models\ContactModel

@bessudnov bessudnov added the bug Something isn't working label Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants