-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[QUESTION] Confusion About ToCollection concerns? #1999
Comments
Import objects are there to encapsulate your import logic. You can add a lot of behaviour by using the other concerns.
If you use You have to use either I think the |
@patrickbrouwers So how then do you actually accomplish what @nickpoulos wanted to do and what I want to do. Which is to call a method that returns a collection that's been put through a transformer first and that's it, no models involved, just return a transformed collection from a .csv file.. seems like a simple enough task that this package should be able to handle easily |
phew.. managed to get something working in my controller:
MyImport.php:
|
@patrickbrouwers i am trying to use skierrors and skipfailure traits with tocollection but its not working. But with toModel its working fine. how can i skip errors in toCollection and collect them in the last? |
Prerequisites
Versions
Description
The import functionality is not intuitive how it is all supposed to work together, and not documented well enough to alleviate the lack of intuition. I am confused as to what the point of a ToCollection concern is exactly?
I tried to setup a very simple toCollection import. I don't want the items actually stored in a database at the time of Excel file reading because I need to sum and run calculations on the data first, then pass it off to other objects that actually handle the importing and logging. I don't want a mega import class.
So I setup a simple Import using the toCollection concern, like so:
Then I tried to import using:
Which returns a MaatWebsiteExcel object that I can't seem to access the collection of data. And not even that, I stuck a DD in my collection() method of KargoImport, and the function doesn't even get hit?
So instead I tried:
That at least returned my data, but again, it was not run through the collections() function at all.
I get the same exact results when I pass in a null importer like so:
So that tells me for my purposes, the Importer is useless? But it doesn't seem it should be? I would think the first example, using the Excel::import() function with a ToCollection importer as param, would return the collection of rows already run through the Importer->collection() method. This would also allow me to use the other functions/traits for chunking reads and other functionality.
Additional Information
None
The text was updated successfully, but these errors were encountered: