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
[BUG] Error import: object beginTransaction #1998
Comments
We use the database transactions for validation and batch inserts. They are quite vital for the Eloquent/Laravel-DB users. Happy to merge a PR that gives a config option to disable it for users that use .e.g Mongo |
Next version will have a setting to disable Laravel-DB transactions + a way to add custom transaction handlers |
Hi ! I'm in the very exact situation: I need to NOT save read data, and I am using Mongo. Could you point me please to the code that disable transactions? |
|
Relevant documentation section: https://docs.laravel-excel.com/3.1/imports/validation.html#disable-transactions |
Hi, I'm in the same situation: I have to read an excel file and I need to store it in mongodb. edit: I used the import to collection and it works, but I still don't knonw why the import toModel breaks |
Because Collection doesn't use transactions. Please refer to my previous comment, it explains how to disable transactions. |
Hi, thank you for your quick reply. |
You are probably typing something wrong in your config then. |
I also have the same situation, I got the solution on https://docs.laravel-excel.com/3.1/imports/validation.html#disable-transactions |
I have mongodb too. this https://docs.laravel-excel.com/3.1/imports/validation.html#disable-transactions works for me. Thx @patrickbrouwers |
Maybe you guys are having the same issue I did at #2384 Maybe my solution would work for you, try a:
Sometimes, specially when updating a package, Laravel won't clean the cache and your package won't find the config files. Thus, the driver will be always NULL and fail. |
Best Answer |
@patrickbrouwers I use Laravel 8 and MongoDB. I have config 'handler' => 'null' and try 'php artisan config:clear' but it doesn't import excel file to my database |
Prerequisites
Versions
Description
I have created the import object class and specified the Concerns of ToCollection. Upon performing Excel::import, I receive an error shown in
Actual Behavior
below.Steps to Reproduce
Do not use a transactional database. We use MongoDB.
Aside from that, Model importing was not specified and the package should not be doing any database preparation, that should be handled through events by the developer.
Expected behavior:
dd of the collection rows.
Actual behavior:
Additional Information
The text was updated successfully, but these errors were encountered: