1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace AbterPhp\Admin\Http\Controllers\Admin\Form; |
6
|
|
|
|
7
|
|
|
use AbterPhp\Admin\Domain\Entities\UserApiKey as Entity; |
8
|
|
|
use AbterPhp\Admin\Form\Factory\UserApiKey as FormFactory; |
9
|
|
|
use AbterPhp\Admin\Orm\UserApiKeyRepo as Repo; |
10
|
|
|
use AbterPhp\Framework\Assets\AssetManager; |
11
|
|
|
use AbterPhp\Framework\Domain\Entities\IStringerEntity; |
12
|
|
|
use AbterPhp\Framework\Http\Controllers\Admin\FormAbstract; |
13
|
|
|
use AbterPhp\Framework\I18n\ITranslator; |
14
|
|
|
use AbterPhp\Framework\Session\FlashService; |
15
|
|
|
use Cocur\Slugify\Slugify; |
16
|
|
|
use Opulence\Events\Dispatchers\IEventDispatcher; |
17
|
|
|
use Opulence\Routing\Urls\UrlGenerator; |
18
|
|
|
use Opulence\Sessions\ISession; |
19
|
|
|
|
20
|
|
|
class UserApiKey extends FormAbstract |
21
|
|
|
{ |
22
|
|
|
const ENTITY_SINGULAR = 'userApiKey'; |
23
|
|
|
const ENTITY_PLURAL = 'userApiKeys'; |
24
|
|
|
|
25
|
|
|
const ENTITY_TITLE_SINGULAR = 'admin:userApiKey'; |
26
|
|
|
const ENTITY_TITLE_PLURAL = 'admin:userApiKeys'; |
27
|
|
|
|
28
|
|
|
/** @var Slugify */ |
29
|
|
|
protected $slugify; |
30
|
|
|
|
31
|
|
|
/** @var string */ |
32
|
|
|
protected $resource = 'user_api_keys'; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* ApiKey constructor. |
36
|
|
|
* |
37
|
|
|
* @param FlashService $flashService |
38
|
|
|
* @param ITranslator $translator |
39
|
|
|
* @param UrlGenerator $urlGenerator |
40
|
|
|
* @param Repo $repo |
41
|
|
|
* @param ISession $session |
42
|
|
|
* @param FormFactory $formFactory |
43
|
|
|
* @param AssetManager $assetManager |
44
|
|
|
*/ |
45
|
|
|
public function __construct( |
46
|
|
|
FlashService $flashService, |
47
|
|
|
ITranslator $translator, |
48
|
|
|
UrlGenerator $urlGenerator, |
49
|
|
|
Repo $repo, |
50
|
|
|
ISession $session, |
51
|
|
|
FormFactory $formFactory, |
52
|
|
|
IEventDispatcher $eventDispatcher |
53
|
|
|
) { |
54
|
|
|
parent::__construct( |
55
|
|
|
$flashService, |
56
|
|
|
$translator, |
57
|
|
|
$urlGenerator, |
58
|
|
|
$repo, |
59
|
|
|
$session, |
60
|
|
|
$formFactory, |
61
|
|
|
$eventDispatcher |
62
|
|
|
); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @param string $entityId |
67
|
|
|
* |
68
|
|
|
* @return Entity |
69
|
|
|
*/ |
70
|
|
|
public function createEntity(string $entityId): IStringerEntity |
71
|
|
|
{ |
72
|
|
|
$entity = new Entity((string)$entityId, '', ''); |
73
|
|
|
|
74
|
|
|
return $entity; |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|