-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProfilesPresenterTrait.php
More file actions
78 lines (63 loc) · 1.85 KB
/
Copy pathProfilesPresenterTrait.php
File metadata and controls
78 lines (63 loc) · 1.85 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
declare(strict_types=1);
namespace ADT\FancyAdmin\UI\Presenters\Profiles;
use ADT\DoctrineComponents\Entities\Entity;
use ADT\DoctrineForms\BaseFormInterface;
use ADT\FancyAdmin\DI\Injects\AclRoleQueryFactoryInject;
use ADT\FancyAdmin\DI\Injects\EntityManagerInject;
use ADT\FancyAdmin\Model\Entities\Profile;
use ADT\FancyAdmin\Model\Queries\Abstract\BaseQuery;
use ADT\FancyAdmin\Model\Queries\Factories\ProfileQueryFactory;
use ADT\FancyAdmin\UI\Components\Forms\Profile\ProfileFormFactory;
use ADT\FancyAdmin\UI\Components\Grids\Profile\ProfileGrid;
use ADT\FancyAdmin\UI\Components\Grids\Profile\ProfileGridFactory;
use ADT\FancyAdmin\UI\Presenters\PresenterTrait;
use ADT\FancyAdmin\UI\Presenters\SidePanel;
use Kdyby\Autowired\Attributes\Autowire;
trait ProfilesPresenterTrait
{
use SidePanel;
use PresenterTrait;
use EntityManagerInject;
use AclRoleQueryFactoryInject;
#[Autowire]
protected ProfileQueryFactory $_profileQueryFactory;
#[Autowire]
protected ProfileFormFactory $_profileFormFactory;
public function actionDefault(?Profile $profile = null): void
{
if ($profile) {
$this->entity = $profile;
}
$this->template->setFile(__DIR__ . '/default.latte');
}
public function actionDetail(Profile $profile): void
{
$this->entity = $profile;
}
public function handleNew(): void
{
$this->redrawSidePanel();
}
public function handleEdit(Profile $spareParts): void
{
$this->entity = $spareParts;
$this->redrawSidePanel();
}
public function createComponentProfileGrid(ProfileGridFactory $factory): ProfileGrid
{
return $factory->create();
}
protected function getForm(): BaseFormInterface
{
return $this->_profileFormFactory->create();
}
protected function getQueryObject(): BaseQuery
{
return $this->_profileQueryFactory->create();
}
protected function getEntity(): Entity|callable|null
{
return $this->entity;
}
}