I've written an add-on that takes date parameters and gets an order report from an Amazon seller account using the Amazon MWS API. The result for this operation is a nice, big XML object.
What I would like to do with this object is save it as a
.txt file, along with a few other fields, in a channel entry.
I already have the functionality to save the result as a channel entry using the ee model class. I tried saving the object as a string in a text field but there's just too much data to do this.
What I need to know is how to take the xml object and save it as a
.txt file with the channel entry.
I've played around with this suggestion but honestly I'm confused by it and there's no documentation that I can find that relates to this specific question.
This is what I'm currently playing around with. (
$title has a dynamically created value)
$file = ee('Model')->make('File'); $file->title = $title; $file->file_name = $title . '.txt'; $file->upload_location_id = '2'; $file->save();
It doesn't save anything and isn't throwing an error so I'm not sure what I need to change. This also does nothing with the actual xml data. I need to be able to take the XML object, put it into a
.txt file, and save that file with a channel entry.
I'm relatively sure there is a way to do this using the ee model class. If I'm wrong, please point me in the right direction.