1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace AbterPhp\Admin\Http\Controllers\Admin\Execute; |
6
|
|
|
|
7
|
|
|
use AbterPhp\Admin\Service\Execute\ApiClient as RepoService; |
8
|
|
|
use AbterPhp\Framework\Constant\Session; |
9
|
|
|
use AbterPhp\Framework\Http\Controllers\Admin\ExecuteAbstract; |
10
|
|
|
use AbterPhp\Framework\I18n\ITranslator; |
11
|
|
|
use AbterPhp\Framework\Session\FlashService; |
12
|
|
|
use Opulence\Routing\Urls\UrlGenerator; |
13
|
|
|
use Opulence\Sessions\ISession; |
14
|
|
|
use Psr\Log\LoggerInterface; |
15
|
|
|
|
16
|
|
|
class ApiClient extends ExecuteAbstract |
17
|
|
|
{ |
18
|
|
|
const ENTITY_SINGULAR = 'apiClient'; |
19
|
|
|
const ENTITY_PLURAL = 'apiClients'; |
20
|
|
|
|
21
|
|
|
const ENTITY_TITLE_SINGULAR = 'admin:apiClient'; |
22
|
|
|
const ENTITY_TITLE_PLURAL = 'admin:apiClients'; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* ApiClient constructor. |
26
|
|
|
* |
27
|
|
|
* @param FlashService $flashService |
28
|
|
|
* @param ITranslator $translator |
29
|
|
|
* @param UrlGenerator $urlGenerator |
30
|
|
|
* @param LoggerInterface $logger |
31
|
|
|
* @param RepoService $repoService |
32
|
|
|
* @param ISession $session |
33
|
|
|
*/ |
34
|
|
|
public function __construct( |
35
|
|
|
FlashService $flashService, |
36
|
|
|
ITranslator $translator, |
37
|
|
|
UrlGenerator $urlGenerator, |
38
|
|
|
LoggerInterface $logger, |
39
|
|
|
RepoService $repoService, |
40
|
|
|
ISession $session |
41
|
|
|
) { |
42
|
|
|
parent::__construct( |
43
|
|
|
$flashService, |
44
|
|
|
$translator, |
45
|
|
|
$urlGenerator, |
46
|
|
|
$logger, |
|
|
|
|
47
|
|
|
$repoService, |
|
|
|
|
48
|
|
|
$session |
|
|
|
|
49
|
|
|
); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @return array |
54
|
|
|
*/ |
55
|
|
|
protected function getPostData(): array |
56
|
|
|
{ |
57
|
|
|
$postData = $this->request->getPost()->getAll(); |
58
|
|
|
|
59
|
|
|
if ($postData) { |
|
|
|
|
60
|
|
|
$postData['user_id'] = $this->session->get(Session::USER_ID); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
return $postData; |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|