-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathBlogPostStateEnum.php
More file actions
22 lines (18 loc) · 791 Bytes
/
BlogPostStateEnum.php
File metadata and controls
22 lines (18 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
namespace EasyCorp\Bundle\EasyAdminBundle\Tests\Functional\Apps\DefaultApp\Enum;
use Symfony\Contracts\Translation\TranslatableInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
enum BlogPostStateEnum: string implements TranslatableInterface
{
case Draft = 'draft';
case Published = 'published';
case Deleted = 'deleted';
public function trans(TranslatorInterface $translator, ?string $locale = null): string
{
return match ($this) {
self::Draft => $translator->trans('BlogPostStateEnum.draft', locale: $locale),
self::Published => $translator->trans('BlogPostStateEnum.published', locale: $locale),
self::Deleted => $translator->trans('BlogPostStateEnum.deleted', locale: $locale),
};
}
}