numero2 / contao-softgarden-bundle
Import job advertisements from softgarden as news into Contao
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:contao-bundle
Requires
- php: ^8.2
- contao/core-bundle: ^4.13 || ^5.3
- contao/news-bundle: ^4.13 || ^5.3
- doctrine/dbal: ^3.3
- psr/log: ^1.1 || 2.0 || ^3.0
- symfony/config: ^5.4 || ^6.4 || ^7.0
- symfony/dependency-injection: ^5.4 || ^6.4 || ^7.0
- symfony/event-dispatcher: ^5.4 || ^6.4 || ^7.0
- symfony/http-client: ^5.4 || ^6.4 || ^7.0
- symfony/http-client-contracts: ^2.4 || ^3.1
- symfony/http-foundation: ^5.4 || ^6.4 || ^7.0
- symfony/http-kernel: ^5.4 || ^6.4 || ^7.0
- symfony/translation-contracts: ^2.3 || ^3.0
Requires (Dev)
Conflicts
- contao/core: *
- contao/manager-plugin: <2.0 || >=3.0
This package is auto-updated.
Last update: 2025-03-04 11:45:43 UTC
README
About
Import job advertisements from softgarden e-recruiting as news into Contao.
System requirements
- Contao 4.13 (or newer)
Installation
- Install via Contao Manager or Composer (
composer require numero2/contao-softgarden-bundle
) - Run a database update via the Contao-Installtool or using the contao:migrate command.
Events
By default the bundle only imports basic information from softgarden that can be matched to the structure of Contao's news. If you need more data you can import them on your own using the contao.softgarden_import_advertisement
event.
Important
This example shows how to import additional job information from softgarden.
Note: You must first define any custom fields in your own contao/dca/tl_news.php
as they are not part of Contao's core.
// src/EventListener/SoftgardenParseListener.php namespace App\EventListener; use numero2\SoftgardenBundle\API\SoftgardenCatalogTypes; use numero2\SoftgardenBundle\Event\SoftgardenEvents; use numero2\SoftgardenBundle\Event\SoftgardenParseEvent; use Symfony\Component\EventDispatcher\Attribute\AsEventListener; #[AsEventListener(SoftgardenEvents::IMPORT_ADVERTISEMENT)] class SoftgardenParseListener { public function __invoke( SoftgardenParseEvent $event ): void { $position = $event->getPosition(); $news = $event->getNews(); // add some additional data $news->job_company_name = $position->company_name??''; $news->job_location_street = $position->geo_name??''; $news->job_location_postal = $position->geo_zip??''; $news->job_location_city = $position->geo_city??''; $news->job_apply_link = $position->applyOnlineLink??''; $archive = $news->getRelated('pid'); $api = $event->getAPI(); // resolve catalog values $news->job_categegory = $api->resolveCatalogValue(SoftgardenCatalogTypes::jobCategory, $position->jobCategories[0], $archive->softgarden_language)??''; $news->job_audience = $api->resolveCatalogValue(SoftgardenCatalogTypes::audience, $position->audiences[0], $archive->softgarden_language)??''; $news->job_employmentType = $api->resolveCatalogValue(SoftgardenCatalogTypes::employmentType, $position->employmentTypes[0], $archive->softgarden_language)??''; $news->job_workTime = $api->resolveCatalogValue(SoftgardenCatalogTypes::workingHours, $position->workTimes[0], $archive->softgarden_language)??''; $news->job_industry = $api->resolveCatalogValue(SoftgardenCatalogTypes::positionIndustry, $position->industries[0], $archive->softgarden_language)??''; $news->job_experience = $api->resolveCatalogValue(SoftgardenCatalogTypes::workExperience, $position->workExperiences[0], $archive->softgarden_language)??''; } }