PHP code example of oat-sa / oneroster-import

1. Go to this page and download the library: Download oat-sa/oneroster-import library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

oat-sa / oneroster-import example snippets


$fileHandler = new FileHandler();
$importService = new ImportService($fileHandler);
$results = $importService->importMultiple(__DIR__ . '/../data/samples/oneRoster1.0/');

$storage = new InMemoryStorage($results);

$fileHandler = new FileHandler();
$importService = new ImportService($fileHandler);
$importService->setPathToFolder(__DIR__ . '/../../data/samples/OneRosterv1p1BaseCSV/');

$storage = new CsvStorage($importService);

$entityRepository = new EntityRepository($storage, $relationConfig);


// 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)

$oneOrg->getEnrollments();
// return all enrollments assign to organisation.

$oneOrg === $oneOrg->getClasses()->first()->getOrg();