numero2/contao-softgarden-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

numero2/contao-softgarden-bundle

最新稳定版本:1.0.0

Composer 安装命令:

composer require numero2/contao-softgarden-bundle

包简介

Import job advertisements from softgarden as news into Contao

README 文档

README

License: LGPL v3

About

Import job advertisements from softgarden e-recruiting as news into Contao.

System requirements

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)??'';
    }
}

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0
  • 更新时间: 2025-03-03