Update to 00_CSV_Import.md

Adding further explanation for using a custom CsvBulkLoader in ModelAdmin instead of the default one. I think some people might be able to guess at this, but others (like me) might benefit from making things a bit more explicit. This a follow up from my [question on StackOverflow](https://stackoverflow.com/questions/44271755/adding-custom-csvbulkuploader-to-modeladmin-in-silverstripe).
This commit is contained in:
Justin Brown 2017-05-31 09:05:05 -06:00 committed by GitHub
parent 21d2e5cad1
commit ac08e16720

View File

@ -194,6 +194,22 @@ Sample implementation of a custom loader. Assumes a CSV-file in a certain format
}
}
?>
Building off of the ModelAdmin example up top, use a custom loader instead of the default loader by adding it to `$model_importers`. In this example, `CsvBulkLoader` is replaced with `PlayerCsvBulkLoader`.
:::php
<?php
class PlayerAdmin extends ModelAdmin {
private static $managed_models = array(
'Player'
);
private static $model_importers = array(
'Player' => 'PlayerCsvBulkLoader',
);
private static $url_segment = 'players';
}
?>
## Related