mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
21d2e5cad1
commit
ac08e16720
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user