Service layer is probably the way I'd go. So you'd create a service class that looks something like this:
class Your_Service_Import
{
public function importFromCsv($csv)
{
// etc.
}
}
you'd then move all of your controller method code that's after the csv_to_array call into that method, leaving the end of your controller method looking something like this:
$feed = $this->csv_to_array(trim($response->getBody()));
$service = new Your_Service_Import();
$service->importFromCsv($feed);
This makes it easier to test your import code (since it's in a standalone class) and easier to reuse in other parts of your application.
Tim Fountain
2010-07-28 20:54:09