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

Ошибка при создании операции начисления бонусов #73

Open
EvilDevRu opened this issue Jul 11, 2020 · 0 comments

Comments

@EvilDevRu
Copy link

https://github.com/Tooyz/moysklad/blob/6b4687b474a71308bce9429bddeca706ffdc4013/src/Components/Fields/AbstractFieldAccessor.php#L26

Возникает ошибка при начислении бонусов контрагенту. Для начала создаем его

$cp = (new Counterparty($sklad, [ 'name' => (string)$card->barcode, ])) ->create();

И пытаемся начислить ему баллы

(new Bonustransaction($sklad, [ 'agent' => $cp, 'bonusProgram' => $msDiscount, 'bonusValue' => (int)$card->balance, 'transactionType' => 'EARNING', ])) ->create();

Тут возникает ошибка. В meta у нас null который передается в AbstractFieldAccessor::replace. В $fields попадает не массив, а null и все валится. в чем проблема понять пока что не могу, ед решение пока нашел - это сделать так:
foreach ( $fields ?? [] as $fieldName => $field ){
В чем может быть проблема?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant