batchInsert
does not work with ActiveRecord models (probably)
#293
Labels
batchInsert
does not work with ActiveRecord models (probably)
#293
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
atsrc/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
.The text was updated successfully, but these errors were encountered: