PHP code example of cpsit / typo3-personio-jobs

1. Go to this page and download the library: Download cpsit/typo3-personio-jobs 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/ */

    

cpsit / typo3-personio-jobs example snippets


use CPSIT\Typo3PersonioJobs\Service\PersonioApiService;
use TYPO3\CMS\Core\Utility\GeneralUtility;

$apiService = GeneralUtility::makeInstance(PersonioApiService::class);
$jobs = $apiService->getJobs();

foreach ($jobs as $job) {
    echo 'Successfully fetched job: ' . $job->getName() . PHP_EOL;
}

use CPSIT\Typo3PersonioJobs\Service\PersonioImportService;
use TYPO3\CMS\Core\Utility\GeneralUtility;

$importService = GeneralUtility::makeInstance(PersonioImportService::class);
$result = $importService->import();

foreach ($result->getNewJobs() as $newJob) {
    echo 'Imported new job: ' . $newJob->getName() . PHP_EOL;
}

foreach ($result->getUpdatedJobs() as $updatedJob) {
    echo 'Updated job: ' . $updatedJob->getName() . PHP_EOL;
}

foreach ($result->getRemovedJobs() as $removedJob) {
    echo 'Removed job: ' . $removedJob->getName() . PHP_EOL;
}

foreach ($result->getSkippedJobs() as $skippedJob) {
    echo 'Skipped job: ' . $skippedJob->getName() . PHP_EOL;
}