Skip to content

Commit 08de0b4

Browse files
TatevikGrtatevikg1
andauthored
ISSUE-345: adjust entities and repos to rest-api use cases
* ISSUE-345: add relation to subscriber attributes * ISSUE-345: return self after set * ISSUE-345: fix traits * ISSUE-345: add method in SubscriptionRepository * ISSUE-345: message repository * ISSUE-345: message fixture * ISSUE-345: message fixture + test * ISSUE-345: column name fix * ISSUE-345: remove prefix * ISSUE-345: make format props bool * ISSUE-345: relation to template in message * ISSUE-345: update runner * ISSUE-345: template repo * ISSUE-345: move to dirs * ISSUE-345: add test + fix template * ISSUE-345: message setters * ISSUE-345: tests * ISSUE-345: set message embedded elements * ISSUE-345: sendstart in metadata * ISSUE-345: EmbeddableInterface interface * ISSUE-345: image data resource fix * ISSUE-345: update template property names * ISSUE-345: TemplateImageRepository * ISSUE-345: update admin prop name (email) * ISSUE-345: createdAt/updatedAt * ISSUE-345: add missing repos + cursor trait * ISSUE-345: modifiedBy getter/setter * ISSUE-345: PaginatableRepositoryInterface * ISSUE-345: filter * ISSUE-345: subscriber filter + refactor --------- Co-authored-by: Tatevik <[email protected]>
1 parent 628d9a3 commit 08de0b4

File tree

127 files changed

+2380
-778
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+2380
-778
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on: [push, pull_request]
33
jobs:
44
main:
55
name: phpList on PHP ${{ matrix.php-versions }} [Build, Test]
6-
runs-on: ubuntu-20.04
6+
runs-on: ubuntu-22.04
77
env:
88
DB_DATABASE: phplist
99
DB_USERNAME: root

.github/workflows/core-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on: [push, pull_request]
33
jobs:
44
make-restapi-docs:
55
name: Checkout phpList core and generate docs using `phpDocumentor`
6-
runs-on: ubuntu-20.04
6+
runs-on: ubuntu-22.04
77
steps:
88
- name: Checkout
99
uses: actions/checkout@v3
@@ -41,7 +41,7 @@ jobs:
4141
path: phpdocumentor.zip
4242
deploy-docs:
4343
name: Deploy Core Docs
44-
runs-on: ubuntu-20.04
44+
runs-on: ubuntu-22.04
4545
needs: make-restapi-docs
4646
steps:
4747
- name: Checkout phplist/core-docs

config/repositories.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ services:
1111
arguments:
1212
- PhpList\Core\Domain\Model\Identity\AdministratorToken
1313

14-
PhpList\Core\Domain\Repository\Messaging\SubscriberListRepository:
14+
PhpList\Core\Domain\Repository\Subscription\SubscriberListRepository:
1515
parent: PhpList\Core\Domain\Repository
1616
arguments:
17-
- PhpList\Core\Domain\Model\Messaging\SubscriberList
17+
- PhpList\Core\Domain\Model\Subscription\SubscriberList
1818

1919
PhpList\Core\Domain\Repository\Subscription\SubscriberRepository:
2020
parent: PhpList\Core\Domain\Repository
@@ -25,3 +25,18 @@ services:
2525
parent: PhpList\Core\Domain\Repository
2626
arguments:
2727
- PhpList\Core\Domain\Model\Subscription\Subscription
28+
29+
PhpList\Core\Domain\Repository\Messaging\MessageRepository:
30+
parent: PhpList\Core\Domain\Repository
31+
arguments:
32+
- PhpList\Core\Domain\Model\Messaging\Message
33+
34+
PhpList\Core\Domain\Repository\Messaging\TemplateRepository:
35+
parent: PhpList\Core\Domain\Repository
36+
arguments:
37+
- PhpList\Core\Domain\Model\Messaging\Template
38+
39+
PhpList\Core\Domain\Repository\Messaging\TemplateImageRepository:
40+
parent: PhpList\Core\Domain\Repository
41+
arguments:
42+
- PhpList\Core\Domain\Model\Messaging\TemplateImage
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpList\Core\Domain\Filter;
6+
7+
interface FilterRequestInterface
8+
{
9+
10+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpList\Core\Domain\Filter;
6+
7+
use PhpList\Core\Domain\Model\Identity\Administrator;
8+
9+
class MessageFilter implements FilterRequestInterface
10+
{
11+
private ?Administrator $owner = null;
12+
13+
public function getOwner(): ?Administrator
14+
{
15+
return $this->owner;
16+
}
17+
18+
public function setOwner(?Administrator $admin): self
19+
{
20+
$this->owner = $admin;
21+
return $this;
22+
}
23+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpList\Core\Domain\Filter;
6+
7+
class SubscriberFilter implements FilterRequestInterface
8+
{
9+
private ?int $listId = null;
10+
11+
public function setListId(?int $listId): self
12+
{
13+
$this->listId = $listId;
14+
return $this;
15+
}
16+
17+
public function getListId(): ?int
18+
{
19+
return $this->listId;
20+
}
21+
}

src/Domain/Model/Analytics/LinkTrackForward.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Doctrine\ORM\Mapping as ORM;
88
use PhpList\Core\Domain\Model\Interfaces\DomainModel;
99
use PhpList\Core\Domain\Model\Interfaces\Identity;
10-
use PhpList\Core\Domain\Model\Traits\IdentityTrait;
1110
use PhpList\Core\Domain\Repository\Analytics\LinkTrackForwardRepository;
1211

1312
#[ORM\Entity(repositoryClass: LinkTrackForwardRepository::class)]
@@ -17,7 +16,10 @@
1716
#[ORM\Index(name: 'uuididx', columns: ['uuid'])]
1817
class LinkTrackForward implements DomainModel, Identity
1918
{
20-
use IdentityTrait;
19+
#[ORM\Id]
20+
#[ORM\Column(type: 'integer')]
21+
#[ORM\GeneratedValue]
22+
private ?int $id = null;
2123

2224
#[ORM\Column(type: 'string', length: 2083, nullable: true)]
2325
private ?string $url = null;
@@ -31,6 +33,11 @@ class LinkTrackForward implements DomainModel, Identity
3133
#[ORM\Column(type: 'boolean', nullable: true, options: ['default' => 0])]
3234
private bool $personalise = false;
3335

36+
public function getId(): ?int
37+
{
38+
return $this->id;
39+
}
40+
3441
public function getUrl(): ?string
3542
{
3643
return $this->url;

src/Domain/Model/Analytics/LinkTrackUmlClick.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Doctrine\ORM\Mapping as ORM;
99
use PhpList\Core\Domain\Model\Interfaces\DomainModel;
1010
use PhpList\Core\Domain\Model\Interfaces\Identity;
11-
use PhpList\Core\Domain\Model\Traits\IdentityTrait;
1211
use PhpList\Core\Domain\Repository\Analytics\LinkTrackUmlClickRepository;
1312

1413
#[ORM\Entity(repositoryClass: LinkTrackUmlClickRepository::class)]
@@ -19,7 +18,10 @@
1918
#[ORM\Index(name: 'uidindex', columns: ['userid'])]
2019
class LinkTrackUmlClick implements DomainModel, Identity
2120
{
22-
use IdentityTrait;
21+
#[ORM\Id]
22+
#[ORM\Column(type: 'integer')]
23+
#[ORM\GeneratedValue]
24+
private ?int $id = null;
2325

2426
#[ORM\Column(name: 'messageid', type: 'integer')]
2527
private int $messageId;
@@ -45,6 +47,11 @@ class LinkTrackUmlClick implements DomainModel, Identity
4547
#[ORM\Column(name: 'textclicked', type: 'integer', nullable: true, options: ['default' => 0])]
4648
private ?int $textClicked = 0;
4749

50+
public function getId(): ?int
51+
{
52+
return $this->id;
53+
}
54+
4855
public function getMessageId(): int
4956
{
5057
return $this->messageId;

src/Domain/Model/Analytics/UserMessageView.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@
88
use Doctrine\ORM\Mapping as ORM;
99
use PhpList\Core\Domain\Model\Interfaces\DomainModel;
1010
use PhpList\Core\Domain\Model\Interfaces\Identity;
11-
use PhpList\Core\Domain\Model\Traits\IdentityTrait;
11+
use PhpList\Core\Domain\Repository\Analytics\UserMessageViewRepository;
1212

13-
#[ORM\Entity]
13+
#[ORM\Entity(repositoryClass: UserMessageViewRepository::class)]
1414
#[ORM\Table(name: 'phplist_user_message_view')]
1515
#[ORM\Index(name: 'msgidx', columns: ['messageid'])]
1616
#[ORM\Index(name: 'useridx', columns: ['userid'])]
1717
#[ORM\Index(name: 'usermsgidx', columns: ['userid', 'messageid'])]
1818
class UserMessageView implements DomainModel, Identity
1919
{
20-
use IdentityTrait;
20+
#[ORM\Id]
21+
#[ORM\Column(type: 'integer')]
22+
#[ORM\GeneratedValue]
23+
private ?int $id = null;
2124

2225
#[ORM\Column(name: 'messageid', type: 'integer')]
2326
private int $messageId;
@@ -34,6 +37,11 @@ class UserMessageView implements DomainModel, Identity
3437
#[ORM\Column(name: 'data', type: 'text', nullable: true)]
3538
private ?string $data = null;
3639

40+
public function getId(): ?int
41+
{
42+
return $this->id;
43+
}
44+
3745
public function getMessageId(): int
3846
{
3947
return $this->messageId;

src/Domain/Model/Analytics/UserStats.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
use Doctrine\ORM\Mapping as ORM;
88
use PhpList\Core\Domain\Model\Interfaces\DomainModel;
99
use PhpList\Core\Domain\Model\Interfaces\Identity;
10-
use PhpList\Core\Domain\Model\Traits\IdentityTrait;
10+
use PhpList\Core\Domain\Repository\Analytics\UserStatsRepository;
1111

12-
#[ORM\Entity]
12+
#[ORM\Entity(repositoryClass: UserStatsRepository::class)]
1313
#[ORM\Table(name: 'phplist_userstats')]
1414
#[ORM\UniqueConstraint(name: 'entry', columns: ['unixdate', 'item', 'listid'])]
1515
#[ORM\Index(name: 'dateindex', columns: ['unixdate'])]
@@ -18,7 +18,10 @@
1818
#[ORM\Index(name: 'listindex', columns: ['listid'])]
1919
class UserStats implements DomainModel, Identity
2020
{
21-
use IdentityTrait;
21+
#[ORM\Id]
22+
#[ORM\Column(type: 'integer')]
23+
#[ORM\GeneratedValue]
24+
private ?int $id = null;
2225

2326
#[ORM\Column(name: 'unixdate', type: 'integer', nullable: true)]
2427
private ?int $unixDate = null;
@@ -32,6 +35,11 @@ class UserStats implements DomainModel, Identity
3235
#[ORM\Column(name: 'value', type: 'integer', options: ['default' => 0])]
3336
private int $value = 0;
3437

38+
public function getId(): ?int
39+
{
40+
return $this->id;
41+
}
42+
3543
public function getUnixDate(): ?int
3644
{
3745
return $this->unixDate;

0 commit comments

Comments
 (0)