Skip to content

Commit 6dbbee9

Browse files
TatevikGrtatevikg1
andauthored
ISSUE-345: attributes + import/export
* ISSUE-345: move logic to core * ISSUE-345: attribute definition controller * ISSUE-345: naming * ISSUE-345: subscriber attribute value * ISSUE-345: update after core update * ISSUE-345: Feature-based structure * ISSUE-345: subscriber attribute relation * ISSUE-345: tests folder restructure * ISSUE-345: add tests * ISSUE-345: update normalizers * ISSUE-345: admin attributes * ISSUE-345: tests + swagger * ISSUE-345: refactor * ISSUE-345: subscriber export/import * ISSUE-345: subscriber import update * ISSUE-345: subscriber export options * ISSUE-345: use post for export add tests * ISSUE-345: mark routes * ISSUE-345: phpcs fix * ISSUE-345: update example * ISSUE-345: new tag --------- Co-authored-by: Tatevik <[email protected]>
1 parent 1d412e5 commit 6dbbee9

File tree

219 files changed

+5991
-3082
lines changed

Some content is hidden

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

219 files changed

+5991
-3082
lines changed

composer.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
},
3232
"require": {
3333
"php": "^8.1",
34-
"phplist/core": "v5.0.0-alpha6",
34+
"phplist/core": "v5.0.0-alpha7",
3535
"friendsofsymfony/rest-bundle": "*",
3636
"symfony/test-pack": "^1.0",
3737
"symfony/process": "^6.4",
@@ -97,8 +97,18 @@
9797
"PhpList\\RestBundle\\PhpListRestBundle"
9898
],
9999
"routes": {
100-
"rest-api": {
101-
"resource": "@PhpListRestBundle/Controller/",
100+
"rest-api-identity": {
101+
"resource": "@PhpListRestBundle/Identity/Controller/",
102+
"type": "attribute",
103+
"prefix": "/api/v2"
104+
},
105+
"rest-api-subscription": {
106+
"resource": "@PhpListRestBundle/Subscription/Controller/",
107+
"type": "attribute",
108+
"prefix": "/api/v2"
109+
},
110+
"rest-api-messaging": {
111+
"resource": "@PhpListRestBundle/Messaging/Controller/",
102112
"type": "attribute",
103113
"prefix": "/api/v2"
104114
}

config/services.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ services:
44
Psr\Container\ContainerInterface:
55
alias: 'service_container'
66

7-
PhpList\RestBundle\Controller\:
8-
resource: '../src/Controller'
9-
public: true
10-
autowire: true
11-
tags: ['controller.service_arguments']
12-
137
my.secure_handler:
148
class: PhpList\RestBundle\ViewHandler\SecuredViewHandler
159

config/services/builders.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ services:
44
autoconfigure: true
55
public: false
66

7-
PhpList\RestBundle\Service\Builder\MessageBuilder:
7+
PhpList\Core\Domain\Messaging\Service\Builder\MessageBuilder:
88
autowire: true
99
autoconfigure: true
1010

11-
PhpList\RestBundle\Service\Builder\MessageFormatBuilder:
11+
PhpList\Core\Domain\Messaging\Service\Builder\MessageFormatBuilder:
1212
autowire: true
1313
autoconfigure: true
1414

15-
PhpList\RestBundle\Service\Builder\MessageScheduleBuilder:
15+
PhpList\Core\Domain\Messaging\Service\Builder\MessageScheduleBuilder:
1616
autowire: true
1717
autoconfigure: true
1818

19-
PhpList\RestBundle\Service\Builder\MessageContentBuilder:
19+
PhpList\Core\Domain\Messaging\Service\Builder\MessageContentBuilder:
2020
autowire: true
2121
autoconfigure: true
2222

23-
PhpList\RestBundle\Service\Builder\MessageOptionsBuilder:
23+
PhpList\Core\Domain\Messaging\Service\Builder\MessageOptionsBuilder:
2424
autowire: true
2525
autoconfigure: true

config/services/controllers.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
services:
2+
_defaults:
3+
autowire: true
4+
autoconfigure: true
5+
public: false
6+
7+
PhpList\RestBundle\Identity\Controller\:
8+
resource: '../src/Identity/Controller'
9+
tags: [ 'controller.service_arguments' ]
10+
autowire: true
11+
autoconfigure: true
12+
public: true
13+
14+
PhpList\RestBundle\Messaging\Controller\:
15+
resource: '../src/Messaging/Controller'
16+
tags: [ 'controller.service_arguments' ]
17+
autowire: true
18+
autoconfigure: true
19+
public: true
20+
21+
PhpList\RestBundle\Subscription\Controller\:
22+
resource: '../src/Subscription/Controller'
23+
tags: [ 'controller.service_arguments' ]
24+
autowire: true
25+
autoconfigure: true
26+
public: true

config/services/factories.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ services:
44
autoconfigure: true
55
public: false
66

7-
PhpList\RestBundle\Service\Factory\PaginationCursorRequestFactory:
7+
PhpList\RestBundle\Common\Service\Factory\PaginationCursorRequestFactory:
88
autowire: true
99
autoconfigure: true

config/services/listeners.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ services:
44
autoconfigure: true
55
public: false
66

7-
PhpList\RestBundle\EventListener\ExceptionListener:
7+
PhpList\RestBundle\Common\EventListener\ExceptionListener:
88
tags:
99
- { name: kernel.event_listener, event: kernel.exception }
1010

11-
PhpList\RestBundle\EventListener\ResponseListener:
11+
PhpList\RestBundle\Common\EventListener\ResponseListener:
1212
tags:
1313
- { name: kernel.event_listener, event: kernel.response }

config/services/managers.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,38 @@ services:
44
autoconfigure: true
55
public: false
66

7-
PhpList\RestBundle\Service\Manager\SubscriberManager:
7+
PhpList\Core\Domain\Subscription\Service\Manager\SubscriberManager:
88
autowire: true
99
autoconfigure: true
1010

11-
PhpList\RestBundle\Service\Manager\SessionManager:
11+
PhpList\Core\Domain\Identity\Service\SessionManager:
1212
autowire: true
1313
autoconfigure: true
1414

15-
PhpList\RestBundle\Service\Manager\SubscriberListManager:
15+
PhpList\Core\Domain\Subscription\Service\Manager\SubscriberListManager:
1616
autowire: true
1717
autoconfigure: true
1818

19-
PhpList\RestBundle\Service\Manager\SubscriptionManager:
19+
PhpList\Core\Domain\Subscription\Service\Manager\SubscriptionManager:
2020
autowire: true
2121
autoconfigure: true
2222

23-
PhpList\RestBundle\Service\Manager\MessageManager:
23+
PhpList\Core\Domain\Messaging\Service\MessageManager:
2424
autowire: true
2525
autoconfigure: true
2626

27-
PhpList\RestBundle\Service\Manager\TemplateManager:
27+
PhpList\Core\Domain\Messaging\Service\TemplateManager:
2828
autowire: true
2929
autoconfigure: true
3030

31-
PhpList\RestBundle\Service\Manager\TemplateImageManager:
31+
PhpList\Core\Domain\Messaging\Service\TemplateImageManager:
3232
autowire: true
3333
autoconfigure: true
3434

35-
PhpList\RestBundle\Service\Manager\AdministratorManager:
35+
PhpList\Core\Domain\Identity\Service\AdministratorManager:
36+
autowire: true
37+
autoconfigure: true
38+
39+
PhpList\Core\Domain\Subscription\Service\SubscriberCsvExporter:
3640
autowire: true
3741
autoconfigure: true

config/services/normalizers.yml

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,61 @@ services:
1111
$classMetadataFactory: '@?serializer.mapping.class_metadata_factory'
1212
$nameConverter: '@Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter'
1313

14-
PhpList\RestBundle\Serializer\SubscriberNormalizer:
14+
PhpList\RestBundle\Subscription\Serializer\SubscriberNormalizer:
1515
tags: [ 'serializer.normalizer' ]
1616
autowire: true
1717

18-
PhpList\RestBundle\Serializer\AdministratorTokenNormalizer:
18+
PhpList\RestBundle\Subscription\Serializer\SubscriberOnlyNormalizer:
1919
tags: [ 'serializer.normalizer' ]
2020
autowire: true
2121

22-
PhpList\RestBundle\Serializer\SubscriberListNormalizer:
22+
PhpList\RestBundle\Identity\Serializer\AdministratorTokenNormalizer:
2323
tags: [ 'serializer.normalizer' ]
2424
autowire: true
2525

26-
PhpList\RestBundle\Serializer\SubscriptionNormalizer:
26+
PhpList\RestBundle\Subscription\Serializer\SubscriberListNormalizer:
2727
tags: [ 'serializer.normalizer' ]
2828
autowire: true
2929

30-
PhpList\RestBundle\Serializer\MessageNormalizer:
30+
PhpList\RestBundle\Subscription\Serializer\SubscriptionNormalizer:
3131
tags: [ 'serializer.normalizer' ]
3232
autowire: true
3333

34-
PhpList\RestBundle\Serializer\TemplateImageNormalizer:
34+
PhpList\RestBundle\Messaging\Serializer\MessageNormalizer:
3535
tags: [ 'serializer.normalizer' ]
3636
autowire: true
3737

38-
PhpList\RestBundle\Serializer\TemplateNormalizer:
38+
PhpList\RestBundle\Messaging\Serializer\TemplateImageNormalizer:
3939
tags: [ 'serializer.normalizer' ]
4040
autowire: true
4141

42-
PhpList\RestBundle\Serializer\AdministratorNormalizer:
42+
PhpList\RestBundle\Messaging\Serializer\TemplateNormalizer:
4343
tags: [ 'serializer.normalizer' ]
4444
autowire: true
4545

46-
PhpList\RestBundle\Serializer\CursorPaginationNormalizer:
46+
PhpList\RestBundle\Identity\Serializer\AdministratorNormalizer:
47+
tags: [ 'serializer.normalizer' ]
48+
autowire: true
49+
50+
PhpList\RestBundle\Identity\Serializer\AdminAttributeDefinitionNormalizer:
51+
tags: [ 'serializer.normalizer' ]
52+
autowire: true
53+
54+
PhpList\RestBundle\Identity\Serializer\AdminAttributeValueNormalizer:
55+
tags: [ 'serializer.normalizer' ]
56+
autowire: true
57+
58+
PhpList\RestBundle\Subscription\Serializer\AttributeDefinitionNormalizer:
59+
tags: [ 'serializer.normalizer' ]
60+
autowire: true
61+
62+
PhpList\RestBundle\Subscription\Serializer\SubscriberAttributeValueNormalizer:
63+
tags: [ 'serializer.normalizer' ]
64+
autowire: true
65+
66+
PhpList\RestBundle\Common\Serializer\CursorPaginationNormalizer:
67+
autowire: true
68+
69+
PhpList\RestBundle\Subscription\Serializer\SubscribersExportRequestNormalizer:
70+
tags: [ 'serializer.normalizer' ]
4771
autowire: true

config/services/providers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ services:
44
autoconfigure: true
55
public: false
66

7-
PhpList\RestBundle\Service\Provider\PaginatedDataProvider:
7+
PhpList\RestBundle\Common\Service\Provider\PaginatedDataProvider:
88
autowire: true
99
autoconfigure: true

config/services/validators.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
11
services:
2-
PhpList\RestBundle\Validator\RequestValidator:
2+
PhpList\RestBundle\Common\Validator\RequestValidator:
33
autowire: true
44
autoconfigure: true
55
public: false
66

7-
PhpList\RestBundle\Validator\Constraint\UniqueEmailValidator:
7+
PhpList\RestBundle\Identity\Validator\Constraint\UniqueEmailValidator:
88
autowire: true
99
autoconfigure: true
1010
tags: [ 'validator.constraint_validator' ]
1111

12-
PhpList\RestBundle\Validator\Constraint\EmailExistsValidator:
12+
PhpList\RestBundle\Subscription\Validator\Constraint\UniqueEmailValidator:
1313
autowire: true
1414
autoconfigure: true
1515
tags: [ 'validator.constraint_validator' ]
1616

17-
PhpList\RestBundle\Validator\Constraint\TemplateExistsValidator:
17+
PhpList\RestBundle\Subscription\Validator\Constraint\EmailExistsValidator:
1818
autowire: true
1919
autoconfigure: true
2020
tags: [ 'validator.constraint_validator' ]
2121

22-
PhpList\RestBundle\Validator\TemplateLinkValidator:
22+
PhpList\RestBundle\Messaging\Validator\Constraint\TemplateExistsValidator:
2323
autowire: true
2424
autoconfigure: true
25+
tags: [ 'validator.constraint_validator' ]
26+
27+
PhpList\RestBundle\Messaging\Validator\Constraint\ContainsPlaceholderValidator:
28+
tags: ['validator.constraint_validator']
2529

26-
PhpList\RestBundle\Validator\TemplateImageValidator:
30+
PhpList\RestBundle\Identity\Validator\Constraint\UniqueLoginNameValidator:
2731
autowire: true
2832
autoconfigure: true
33+
tags: [ 'validator.constraint_validator' ]
2934

30-
PhpList\RestBundle\Validator\Constraint\ContainsPlaceholderValidator:
31-
tags: ['validator.constraint_validator']
32-
33-
PhpList\RestBundle\Validator\Constraint\UniqueLoginNameValidator:
35+
PhpList\RestBundle\Subscription\Validator\Constraint\ListExistsValidator:
3436
autowire: true
3537
autoconfigure: true
3638
tags: [ 'validator.constraint_validator' ]

src/Controller/BaseController.php renamed to src/Common/Controller/BaseController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
declare(strict_types=1);
44

5-
namespace PhpList\RestBundle\Controller;
5+
namespace PhpList\RestBundle\Common\Controller;
66

7-
use PhpList\Core\Domain\Model\Identity\Administrator;
7+
use PhpList\Core\Domain\Identity\Model\Administrator;
88
use PhpList\Core\Security\Authentication;
9-
use PhpList\RestBundle\Validator\RequestValidator;
9+
use PhpList\RestBundle\Common\Validator\RequestValidator;
1010
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1111
use Symfony\Component\HttpFoundation\Request;
1212
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;

src/Entity/Dto/CursorPaginationResult.php renamed to src/Common/Dto/CursorPaginationResult.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace PhpList\RestBundle\Entity\Dto;
5+
namespace PhpList\RestBundle\Common\Dto;
66

77
class CursorPaginationResult
88
{

src/Entity/Dto/ValidationContext.php renamed to src/Common/Dto/ValidationContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace PhpList\RestBundle\Entity\Dto;
5+
namespace PhpList\RestBundle\Common\Dto;
66

77
class ValidationContext
88
{

src/EventListener/ExceptionListener.php renamed to src/Common/EventListener/ExceptionListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
declare(strict_types=1);
44

5-
namespace PhpList\RestBundle\EventListener;
5+
namespace PhpList\RestBundle\Common\EventListener;
66

77
use Exception;
8-
use PhpList\RestBundle\Exception\SubscriptionCreationException;
8+
use PhpList\Core\Domain\Subscription\Exception\SubscriptionCreationException;
99
use Symfony\Component\HttpFoundation\JsonResponse;
1010
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
1111
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;

src/EventListener/ResponseListener.php renamed to src/Common/EventListener/ResponseListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace PhpList\RestBundle\EventListener;
5+
namespace PhpList\RestBundle\Common\EventListener;
66

77
use Symfony\Component\HttpFoundation\JsonResponse;
88
use Symfony\Component\HttpKernel\Event\ResponseEvent;

src/Entity/Request/PaginationCursorRequest.php renamed to src/Common/Request/PaginationCursorRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace PhpList\RestBundle\Entity\Request;
5+
namespace PhpList\RestBundle\Common\Request;
66

77
use Symfony\Component\HttpFoundation\Request;
88

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\RestBundle\Common\Request;
6+
7+
interface RequestInterface
8+
{
9+
public function getDto(): mixed;
10+
}

src/Serializer/CursorPaginationNormalizer.php renamed to src/Common/Serializer/CursorPaginationNormalizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
declare(strict_types=1);
44

5-
namespace PhpList\RestBundle\Serializer;
5+
namespace PhpList\RestBundle\Common\Serializer;
66

7-
use PhpList\RestBundle\Entity\Dto\CursorPaginationResult;
7+
use PhpList\RestBundle\Common\Dto\CursorPaginationResult;
88
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
99

1010
class CursorPaginationNormalizer implements NormalizerInterface

src/Service/Factory/PaginationCursorRequestFactory.php renamed to src/Common/Service/Factory/PaginationCursorRequestFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
declare(strict_types=1);
44

5-
namespace PhpList\RestBundle\Service\Factory;
5+
namespace PhpList\RestBundle\Common\Service\Factory;
66

7-
use PhpList\RestBundle\Entity\Request\PaginationCursorRequest;
7+
use PhpList\RestBundle\Common\Request\PaginationCursorRequest;
88
use Symfony\Component\HttpFoundation\Request;
99

1010
class PaginationCursorRequestFactory

0 commit comments

Comments
 (0)