Skip to content

Commit 87a349e

Browse files
committed
admin models
1 parent 2317b50 commit 87a349e

10 files changed

+394
-6
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpList\Core\Domain\Model\Identity;
6+
7+
use Doctrine\ORM\Mapping as ORM;
8+
use PhpList\Core\Domain\Model\Interfaces\DomainModel;
9+
use PhpList\Core\Domain\Model\Interfaces\Identity;
10+
use PhpList\Core\Domain\Model\Traits\IdentityTrait;
11+
use PhpList\Core\Domain\Repository\Identity\AdminAttributeRepository;
12+
13+
#[ORM\Entity(repositoryClass: AdminAttributeRepository::class)]
14+
#[ORM\Table(name: 'phplist_admin_attribute')]
15+
#[ORM\HasLifecycleCallbacks]
16+
class AdminAttribute implements DomainModel, Identity
17+
{
18+
use IdentityTrait;
19+
20+
#[ORM\Column(name: 'name', type: 'string', length: 255)]
21+
private string $name;
22+
23+
#[ORM\Column(name: 'type', type: 'string', length: 30, nullable: true)]
24+
private ?string $type;
25+
26+
#[ORM\Column(name: 'listorder', type: 'integer', nullable: true)]
27+
private ?int $listOrder;
28+
29+
#[ORM\Column(name: 'default_value', type: 'string', length: 255, nullable: true)]
30+
private ?string $defaultValue;
31+
32+
#[ORM\Column(type: 'boolean', nullable: true)]
33+
private ?bool $required;
34+
35+
#[ORM\Column(name:'tablename', type: 'string', length: 255, nullable: true)]
36+
private ?string $tableName;
37+
38+
public function __construct(
39+
string $name,
40+
?string $type = null,
41+
?int $listOrder = null,
42+
?string $defaultValue = null,
43+
?bool $required = null,
44+
?string $tableName = null
45+
) {
46+
$this->name = $name;
47+
$this->type = $type;
48+
$this->listOrder = $listOrder;
49+
$this->defaultValue = $defaultValue;
50+
$this->required = $required;
51+
$this->tableName = $tableName;
52+
}
53+
54+
public function getId(): int
55+
{
56+
return $this->id;
57+
}
58+
59+
public function getName(): string
60+
{
61+
return $this->name;
62+
}
63+
64+
public function getType(): ?string
65+
{
66+
return $this->type;
67+
}
68+
69+
public function getListOrder(): ?int
70+
{
71+
return $this->listOrder;
72+
}
73+
74+
public function getDefaultValue(): ?string
75+
{
76+
return $this->defaultValue;
77+
}
78+
79+
public function isRequired(): ?bool
80+
{
81+
return $this->required;
82+
}
83+
84+
public function getTableName(): ?string
85+
{
86+
return $this->tableName;
87+
}
88+
89+
public function setName(string $name): void
90+
{
91+
$this->name = $name;
92+
}
93+
94+
public function setType(?string $type): void
95+
{
96+
$this->type = $type;
97+
}
98+
99+
public function setListOrder(?int $listOrder): void
100+
{
101+
$this->listOrder = $listOrder;
102+
}
103+
104+
public function setDefaultValue(?string $defaultValue): void
105+
{
106+
$this->defaultValue = $defaultValue;
107+
}
108+
109+
public function setRequired(?bool $required): void
110+
{
111+
$this->required = $required;
112+
}
113+
114+
public function setTableName(?string $tableName): void
115+
{
116+
$this->tableName = $tableName;
117+
}
118+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpList\Core\Domain\Model\Identity;
6+
7+
use Doctrine\ORM\Mapping as ORM;
8+
use PhpList\Core\Domain\Model\Interfaces\DomainModel;
9+
use PhpList\Core\Domain\Repository\Identity\AdminAttributeRelationRepository;
10+
11+
#[ORM\Entity(repositoryClass: AdminAttributeRelationRepository::class)]
12+
#[ORM\Table(name: 'phplist_admin_attribute')]
13+
#[ORM\HasLifecycleCallbacks]
14+
class AdminAttributeRelation implements DomainModel
15+
{
16+
#[ORM\Id]
17+
#[ORM\Column(name: 'adminattributeid', type: 'integer', options: ['unsigned' => true])]
18+
private int $adminAttributeId;
19+
20+
#[ORM\Id]
21+
#[ORM\Column(name: 'adminid', type: 'integer', options: ['unsigned' => true])]
22+
private int $adminId;
23+
24+
#[ORM\Column(name: 'value', type: 'string', length: 255, nullable: true)]
25+
private ?string $value;
26+
27+
public function __construct(int $adminAttributeId, int $adminId, ?string $value = null)
28+
{
29+
$this->adminAttributeId = $adminAttributeId;
30+
$this->adminId = $adminId;
31+
$this->value = $value;
32+
}
33+
34+
public function getAdminAttributeId(): int
35+
{
36+
return $this->adminAttributeId;
37+
}
38+
39+
public function getAdminId(): int
40+
{
41+
return $this->adminId;
42+
}
43+
44+
public function getValue(): ?string
45+
{
46+
return $this->value;
47+
}
48+
49+
public function setValue(?string $value): void
50+
{
51+
$this->value = $value;
52+
}
53+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpList\Core\Domain\Model\Identity;
6+
7+
use Doctrine\ORM\Mapping as ORM;
8+
use PhpList\Core\Domain\Model\Interfaces\DomainModel;
9+
use PhpList\Core\Domain\Model\Interfaces\Identity;
10+
use PhpList\Core\Domain\Model\Traits\IdentityTrait;
11+
use PhpList\Core\Domain\Repository\Identity\AdminLoginRepository;
12+
13+
#[ORM\Entity(repositoryClass: AdminLoginRepository::class)]
14+
#[ORM\Table(name: 'phplist_admin_login')]
15+
#[ORM\HasLifecycleCallbacks]
16+
class AdminLogin implements DomainModel, Identity
17+
{
18+
use IdentityTrait;
19+
20+
#[ORM\Column(name: 'adminid', type: 'integer', options: ['unsigned' => true])]
21+
private int $adminId;
22+
23+
#[ORM\Column(name: 'moment', type: 'bigint')]
24+
private int $moment;
25+
26+
#[ORM\Column(name: 'remote_ip4', type: 'string', length: 32)]
27+
private string $remoteIp4;
28+
29+
#[ORM\Column(name: 'remote_ip6', type: 'string', length:50)]
30+
private string $remoteIp6;
31+
32+
#[ORM\Column(name: 'sessionid', type: 'string', length:50)]
33+
private string $sessionId;
34+
35+
#[ORM\Column(name: 'active', type: 'boolean')]
36+
private bool $active = false;
37+
38+
public function __construct(
39+
int $adminId,
40+
int $moment,
41+
string $remoteIp4,
42+
string $remoteIp6,
43+
string $sessionId,
44+
) {
45+
$this->adminId = $adminId;
46+
$this->moment = $moment;
47+
$this->remoteIp4 = $remoteIp4;
48+
$this->remoteIp6 = $remoteIp6;
49+
$this->sessionId = $sessionId;
50+
}
51+
52+
public function setActive(bool $active): self
53+
{
54+
$this->active = $active;
55+
56+
return $this;
57+
}
58+
public function getAdminId(): int
59+
{
60+
return $this->adminId;
61+
}
62+
63+
public function getMoment(): int
64+
{
65+
return $this->moment;
66+
}
67+
68+
public function getRemoteIp4(): string
69+
{
70+
return $this->remoteIp4;
71+
}
72+
73+
public function getRemoteIp6(): string
74+
{
75+
return $this->remoteIp6;
76+
}
77+
78+
public function getSessionId(): string
79+
{
80+
return $this->sessionId;
81+
}
82+
83+
public function isActive(): bool
84+
{
85+
return $this->active;
86+
}
87+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpList\Core\Domain\Model\Identity;
6+
7+
use DateTime;
8+
use Doctrine\ORM\Mapping as ORM;
9+
use PhpList\Core\Domain\Model\Interfaces\DomainModel;
10+
use PhpList\Core\Domain\Model\Interfaces\Identity;
11+
use PhpList\Core\Domain\Repository\Identity\AdminPasswordRequestRepository;
12+
13+
#[ORM\Entity(repositoryClass: AdminPasswordRequestRepository::class)]
14+
#[ORM\Table(name: 'phplist_admin_password_request')]
15+
#[ORM\HasLifecycleCallbacks]
16+
class AdminPasswordRequest implements DomainModel, Identity
17+
{
18+
#[ORM\Id]
19+
#[ORM\GeneratedValue]
20+
#[ORM\Column(name: 'id_key', type: 'integer', options: ['unsigned' => true])]
21+
private int $id;
22+
23+
#[ORM\Column(name: 'date', type: 'datetime', nullable: true)]
24+
private ?DateTime $date;
25+
26+
#[ORM\Column(name: 'admin', type: 'integer', nullable: true, options: ['unsigned' => true])]
27+
private ?int $adminId;
28+
29+
#[ORM\Column(name: 'key_value', type: 'string', length: 32)]
30+
private string $keyValue;
31+
32+
public function __construct(?DateTime $date, ?int $adminId, string $keyValue)
33+
{
34+
$this->date = $date;
35+
$this->adminId = $adminId;
36+
$this->keyValue = $keyValue;
37+
}
38+
39+
public function getId(): int
40+
{
41+
return $this->id;
42+
}
43+
44+
public function getDate(): DateTime
45+
{
46+
return $this->date;
47+
}
48+
49+
public function getAdminId(): int
50+
{
51+
return $this->adminId;
52+
}
53+
54+
public function getKeyValue(): string
55+
{
56+
return $this->keyValue;
57+
}
58+
}

0 commit comments

Comments
 (0)