Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 21 |
|
0.00% |
0 / 15 |
CRAP | |
0.00% |
0 / 1 |
OlzEntity | |
0.00% |
0 / 21 |
|
0.00% |
0 / 15 |
342 | |
0.00% |
0 / 1 |
getOnOff | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setOnOff | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getOwnerUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setOwnerUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getOwnerRole | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setOwnerRole | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getCreatedAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setCreatedAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getCreatedByUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setCreatedByUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getLastModifiedAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setLastModifiedAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getLastModifiedByUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setLastModifiedByUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getMetaData | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
20 |
1 | <?php |
2 | |
3 | namespace Olz\Entity\Common; |
4 | |
5 | use Doctrine\ORM\Mapping as ORM; |
6 | use Olz\Entity\Roles\Role; |
7 | use Olz\Entity\Users\User; |
8 | |
9 | #[ORM\MappedSuperclass] |
10 | class OlzEntity { |
11 | #[ORM\Column(type: 'integer', nullable: false, options: ['default' => 1])] |
12 | protected int $on_off; |
13 | |
14 | #[ORM\ManyToOne(targetEntity: User::class)] |
15 | #[ORM\JoinColumn(name: 'owner_user_id', referencedColumnName: 'id', nullable: true)] |
16 | protected ?User $owner_user; |
17 | |
18 | #[ORM\ManyToOne(targetEntity: Role::class)] |
19 | #[ORM\JoinColumn(name: 'owner_role_id', referencedColumnName: 'id', nullable: true)] |
20 | protected ?Role $owner_role; |
21 | |
22 | #[ORM\Column(type: 'datetime', nullable: false, options: ['default' => 'CURRENT_TIMESTAMP'])] |
23 | protected \DateTime $created_at; |
24 | |
25 | #[ORM\ManyToOne(targetEntity: User::class)] |
26 | #[ORM\JoinColumn(name: 'created_by_user_id', referencedColumnName: 'id', nullable: true)] |
27 | protected ?User $created_by_user; |
28 | |
29 | #[ORM\Column(type: 'datetime', nullable: false, options: ['default' => 'CURRENT_TIMESTAMP'])] |
30 | protected \DateTime $last_modified_at; |
31 | |
32 | #[ORM\ManyToOne(targetEntity: User::class)] |
33 | #[ORM\JoinColumn(name: 'last_modified_by_user_id', referencedColumnName: 'id', nullable: true)] |
34 | protected ?User $last_modified_by_user; |
35 | |
36 | public function getOnOff(): int { |
37 | return $this->on_off; |
38 | } |
39 | |
40 | public function setOnOff(int $new_value): void { |
41 | $this->on_off = $new_value; |
42 | } |
43 | |
44 | public function getOwnerUser(): ?User { |
45 | return $this->owner_user; |
46 | } |
47 | |
48 | public function setOwnerUser(?User $new_value): void { |
49 | $this->owner_user = $new_value; |
50 | } |
51 | |
52 | public function getOwnerRole(): ?Role { |
53 | return $this->owner_role; |
54 | } |
55 | |
56 | public function setOwnerRole(?Role $new_value): void { |
57 | $this->owner_role = $new_value; |
58 | } |
59 | |
60 | public function getCreatedAt(): \DateTime { |
61 | return $this->created_at; |
62 | } |
63 | |
64 | public function setCreatedAt(\DateTime $new_value): void { |
65 | $this->created_at = $new_value; |
66 | } |
67 | |
68 | public function getCreatedByUser(): ?User { |
69 | return $this->created_by_user; |
70 | } |
71 | |
72 | public function setCreatedByUser(?User $new_value): void { |
73 | $this->created_by_user = $new_value; |
74 | } |
75 | |
76 | public function getLastModifiedAt(): \DateTime { |
77 | return $this->last_modified_at; |
78 | } |
79 | |
80 | public function setLastModifiedAt(\DateTime $new_value): void { |
81 | $this->last_modified_at = $new_value; |
82 | } |
83 | |
84 | public function getLastModifiedByUser(): ?User { |
85 | return $this->last_modified_by_user; |
86 | } |
87 | |
88 | public function setLastModifiedByUser(?User $new_value): void { |
89 | $this->last_modified_by_user = $new_value; |
90 | } |
91 | |
92 | /** @return array{ownerUserId: ?int, ownerRoleId: ?int, onOff: bool} */ |
93 | public function getMetaData(): array { |
94 | $owner_user = $this->getOwnerUser(); |
95 | $owner_role = $this->getOwnerRole(); |
96 | return [ |
97 | 'ownerUserId' => $owner_user ? $owner_user->getId() : null, |
98 | 'ownerRoleId' => $owner_role ? $owner_role->getId() : null, |
99 | 'onOff' => $this->getOnOff() ? true : false, |
100 | ]; |
101 | } |
102 | } |