oat-sa / oneroster-import
OneRoster PHP Import
v1.1.0
2019-03-28 16:04 UTC
Requires
- php: ^7.2
- doctrine/collections: ^1.6
Requires (Dev)
- codacy/coverage: dev-master
- phpunit/phpunit: ^7.2
This package is auto-updated.
Last update: 2024-12-16 17:11:56 UTC
README
Import CSV files using OneRoster V1.1 standard
More Information about the standard can be found here:
http://www.imsglobal.org/oneroster-v11-final-csv-tables
The scope of this repository it's to import the file and validate the fields according to v1 standard. The json configuration of fields can be found in /config/v1/ folder
Setup InMemoryStorage
$fileHandler = new FileHandler(); $importService = new ImportService($fileHandler); $results = $importService->importMultiple(__DIR__ . '/../data/samples/oneRoster1.0/'); $storage = new InMemoryStorage($results);
Setup CsvStorage
$fileHandler = new FileHandler(); $importService = new ImportService($fileHandler); $importService->setPathToFolder(__DIR__ . '/../../data/samples/OneRosterv1p1BaseCSV/'); $storage = new CsvStorage($importService);
Examples of using entities after import.
1. Setup Entity Repository
$entityRepository = new EntityRepository($storage, $relationConfig);
2. Fetching entities
// get all organisation $orgs = $entityRepository->getAll(Organisation::class); // get one organisation $org = $entityRepository->get('12345', Organisation::class); $org->getId(); //return id of entity $org->getData(); //return the data after format (array)
3. Fetching related entities
$oneOrg->getEnrollments(); // return all enrollments assign to organisation.
Circular
$oneOrg === $oneOrg->getClasses()->first()->getOrg();
More information about relations can be found in config/v1/relations.json