1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
namespace App\Enum;
use App\Entity\OperationAdherent;
use App\Entity\OperationComptoir;
use App\Entity\OperationGroupe;
use App\Entity\OperationPrestataire;
use App\Entity\OperationSiege;
abstract class OperationEnum
{
const OPERATION_ADHERENT = 'OPERATION_ADHERENT';
const OPERATION_PRESTATAIRE = 'OPERATION_PRESTATAIRE';
const OPERATION_COMPTOIR = 'OPERATION_COMPTOIR';
const OPERATION_GROUPE = 'OPERATION_GROUPE';
const OPERATION_SIEGE = 'OPERATION_SIEGE';
/** @var array user friendly named type */
protected static $className = [
self::OPERATION_ADHERENT => OperationAdherent::class,
self::OPERATION_PRESTATAIRE => OperationPrestataire::class,
self::OPERATION_COMPTOIR => OperationComptoir::class,
self::OPERATION_GROUPE => OperationGroupe::class,
self::OPERATION_SIEGE => OperationSiege::class,
];
/**
* @param string $typeShortName
*
* @return string
*/
public static function getClassName($typeShortName)
{
if (!isset(static::$className[$typeShortName])) {
return "Unknown type ($typeShortName)";
}
return static::$className[$typeShortName];
}
/**
* @return array<string>
*/
public static function getAvailableTypes()
{
return [
self::OPERATION_ADHERENT,
self::OPERATION_PRESTATAIRE,
self::OPERATION_COMPTOIR,
self::OPERATION_GROUPE,
self::OPERATION_SIEGE,
];
}
}