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

batchInsert does not work with ActiveRecord models (probably) #293

Open
ilya-realforce opened this issue Jan 10, 2020 · 0 comments
Open
Labels
status:to be verified Needs to be reproduced and validated. type:bug Bug

Comments

@ilya-realforce
Copy link

Doc for \yii\mongodb\Collection::batchInsert() says @param array $rows array of arrays or objects to be inserted, but it doesn't work if you pass array of ActiveRecord into it. Probably because they fall straight into \MongoDB\Driver\BulkWrite::insert at src/Command.php:225, and ActiveRecord doesn't store any data in "real" properties, it stores it in "magic" properties.

Possible solution: use getAttributes() if objects are instances of \yii\mongodb\ActiveRecord before passing them to \MongoDB\Driver\BulkWrite::insert.

@bizley bizley added status:to be verified Needs to be reproduced and validated. type:bug Bug labels Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:to be verified Needs to be reproduced and validated. type:bug Bug
Projects
None yet
Development

No branches or pull requests

2 participants