Make MDProcessType JSON serializable

This commit is contained in:
Joshua Ramon Enslin 2022-10-16 01:13:33 +02:00
parent 42a02c186a
commit b6dcffdea4
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
2 changed files with 19 additions and 1 deletions

View File

@ -9,7 +9,7 @@ declare(strict_types = 1);
/** /**
* Represents a possible type of internal processes in a museum. * Represents a possible type of internal processes in a museum.
*/ */
enum MDProcessType implements MDValueEnumInterface { enum MDProcessType implements MDValueEnumInterface, JsonSerializable {
case project; case project;
case grant_application; case grant_application;
@ -107,4 +107,15 @@ enum MDProcessType implements MDValueEnumInterface {
return $tlLoader->tl("process_types", "process_types", $this->name); return $tlLoader->tl("process_types", "process_types", $this->name);
} }
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
} }

View File

@ -55,4 +55,11 @@ interface MDValueEnumInterface {
* @return string * @return string
*/ */
public function getTledName(MDTlLoader $tlLoader):string; public function getTledName(MDTlLoader $tlLoader):string;
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string;
} }