feat: additional categories for job profiles
addresses #869dv9m9g
This commit is contained in:
+32
-10
@@ -21,12 +21,41 @@ class JobProfile implements BlameableEntityInterface, TimestampableEntityInterfa
|
||||
use SoftDeletableEntity;
|
||||
|
||||
public const CATEGORY_GUIDE = 'guide';
|
||||
public const CATEGORY_COURSE = 'course';
|
||||
public const CATEGORY_COURSE_SKI = 'course_ski';
|
||||
public const CATEGORY_COURSE_SKI_BEGINNER = 'course_ski_beginner';
|
||||
public const CATEGORY_COURSE_SKI_ADVANCED = 'course_ski_advanced';
|
||||
public const CATEGORY_COURSE_BOARD = 'course_board';
|
||||
public const CATEGORY_COURSE_BOARD_BEGINNER = 'course_board_beginner';
|
||||
public const CATEGORY_COURSE_BOARD_ADVANCED = 'course_board_advanced';
|
||||
public const CATEGORY_SERVICE = 'service';
|
||||
public const CATEGORY_EVENT_TEAM = 'event_team';
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function getCategories(): array
|
||||
{
|
||||
return [
|
||||
self::CATEGORY_GUIDE => 'Reiseleitung',
|
||||
self::CATEGORY_COURSE_SKI => 'Kursleitung Ski',
|
||||
self::CATEGORY_COURSE_SKI_BEGINNER => 'Kursleitung Ski Anfänger:innen',
|
||||
self::CATEGORY_COURSE_SKI_ADVANCED => 'Kursleitung Ski fortgeschritten',
|
||||
self::CATEGORY_COURSE_BOARD => 'Kursleitung Board',
|
||||
self::CATEGORY_COURSE_BOARD_BEGINNER => 'Kursleitung Board Anfänger:innen',
|
||||
self::CATEGORY_COURSE_BOARD_ADVANCED => 'Kursleitung Board fortgeschritten',
|
||||
self::CATEGORY_SERVICE => 'Serviceteamer:in',
|
||||
self::CATEGORY_EVENT_TEAM => 'Eventteamer:in',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
public static function getCategoryValues(): array
|
||||
{
|
||||
return array_keys(self::getCategories());
|
||||
}
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
@@ -41,6 +70,7 @@ class JobProfile implements BlameableEntityInterface, TimestampableEntityInterfa
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
#[Assert\NotBlank(message: 'Bitte wähle die Kategorie')]
|
||||
#[Assert\Choice(callback: [self::class, 'getCategoryValues'], message: 'Die Kategorie ist ungültig')]
|
||||
private ?string $category = null;
|
||||
|
||||
#[ORM\Column(type: Types::JSON)]
|
||||
@@ -99,15 +129,7 @@ class JobProfile implements BlameableEntityInterface, TimestampableEntityInterfa
|
||||
|
||||
public function getCategoryLabel(): ?string
|
||||
{
|
||||
return match ($this->category) {
|
||||
static::CATEGORY_GUIDE => 'Reiseleitung',
|
||||
static::CATEGORY_COURSE => 'Kursleitung',
|
||||
static::CATEGORY_COURSE_SKI => 'Kursleitung Ski',
|
||||
static::CATEGORY_COURSE_BOARD => 'Kursleitung Board',
|
||||
static::CATEGORY_SERVICE => 'Serviceteam',
|
||||
static::CATEGORY_EVENT_TEAM => 'Eventteam',
|
||||
default => null,
|
||||
};
|
||||
return self::getCategories()[$this->category] ?? null;
|
||||
}
|
||||
|
||||
public function getRequiredLicenses(): array
|
||||
|
||||
Reference in New Issue
Block a user