-
Notifications
You must be signed in to change notification settings - Fork 123
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
One to many reader #78
Conversation
This also has a pretty cool side effect. You could potentially pass the OneToMany reader with another reader into a new OneToMany reader to merge potentially infinite amount of reader sources. If it's something useful for the project, we'll write up some docs for it. |
Side affect? ;) it was intensional right |
Looks good :) |
Interesting idea! But can't you just do two imports instead, first the orders and then the line items? Each of those imports only needs one reader. |
This would be used in cases when two imports wouldn't suffice. For example, a writer expecting a particular set of data from two sources. One of the models we use to save the data requires the items to be populated on the order before it can be saved. So we can't do two imports. |
Okay, makes sense. |
|
||
/** | ||
* Class OneToManyReader | ||
* @package Ddeboer\DataImport\Reader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this line.
Code is looking good now. Can you add an entry to the readme for this reader? |
Sure - will do this tomorrow! |
@ddeboer All good? |
The resulting data will look like: | ||
|
||
``` | ||
\\Row 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be //
Small small issues remaining. If you fix them and squash commits, this is good to be merged. |
Done :) |
This is failing due to |
I've just rebased this against master again :) |
Thanks for merging! |
We required the ability to add two readers into the same workflow. We have Order and OrderLineData in two CSVs. This reader allows you to this by matching the join fields of two readers.
The test class shows perfectly what we're trying to achieve here.