Skip to content

Commit 425a35b

Browse files
committed
ISSUE-345: Feature-based structure
1 parent 2a13beb commit 425a35b

File tree

105 files changed

+543
-367
lines changed

Some content is hidden

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

105 files changed

+543
-367
lines changed

composer.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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/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/normalizers.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,45 +11,45 @@ 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\Identity\Serializer\AdministratorTokenNormalizer:
1919
tags: [ 'serializer.normalizer' ]
2020
autowire: true
2121

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

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

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

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

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

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

46-
PhpList\RestBundle\Serializer\AttributeDefinitionNormalizer:
46+
PhpList\RestBundle\Subscription\Serializer\AttributeDefinitionNormalizer:
4747
tags: [ 'serializer.normalizer' ]
4848
autowire: true
4949

50-
PhpList\RestBundle\Serializer\SubscriberAttributeValueNormalizer:
50+
PhpList\RestBundle\Subscription\Serializer\SubscriberAttributeValueNormalizer:
5151
tags: [ 'serializer.normalizer' ]
5252
autowire: true
5353

54-
PhpList\RestBundle\Serializer\CursorPaginationNormalizer:
54+
PhpList\RestBundle\Common\Serializer\CursorPaginationNormalizer:
5555
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: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
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\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:
18+
autowire: true
19+
autoconfigure: true
20+
tags: [ 'validator.constraint_validator' ]
21+
22+
PhpList\RestBundle\Messaging\Validator\Constraint\TemplateExistsValidator:
1823
autowire: true
1924
autoconfigure: true
2025
tags: [ 'validator.constraint_validator' ]
@@ -27,10 +32,10 @@ services:
2732
autowire: true
2833
autoconfigure: true
2934

30-
PhpList\RestBundle\Validator\Constraint\ContainsPlaceholderValidator:
35+
PhpList\RestBundle\Messaging\Validator\Constraint\ContainsPlaceholderValidator:
3136
tags: ['validator.constraint_validator']
3237

33-
PhpList\RestBundle\Validator\Constraint\UniqueLoginNameValidator:
38+
PhpList\RestBundle\Identity\Validator\Constraint\UniqueLoginNameValidator:
3439
autowire: true
3540
autoconfigure: true
3641
tags: [ 'validator.constraint_validator' ]

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

Lines changed: 2 additions & 2 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

77
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: 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 Exception;
88
use PhpList\Core\Domain\Subscription\Exception\SubscriptionCreationException;

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

src/Entity/Request/RequestInterface.php renamed to src/Common/Request/RequestInterface.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
interface RequestInterface
88
{

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

src/Service/Provider/PaginatedDataProvider.php renamed to src/Common/Service/Provider/PaginatedDataProvider.php

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

33
declare(strict_types=1);
44

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

77
use Doctrine\ORM\EntityManagerInterface;
88
use PhpList\Core\Domain\Common\Model\Filter\FilterRequestInterface;
99
use PhpList\Core\Domain\Common\Repository\Interfaces\PaginatableRepositoryInterface;
10-
use PhpList\RestBundle\Entity\Dto\CursorPaginationResult;
11-
use PhpList\RestBundle\Serializer\CursorPaginationNormalizer;
12-
use PhpList\RestBundle\Service\Factory\PaginationCursorRequestFactory;
10+
use PhpList\RestBundle\Common\Dto\CursorPaginationResult;
11+
use PhpList\RestBundle\Common\Serializer\CursorPaginationNormalizer;
12+
use PhpList\RestBundle\Common\Service\Factory\PaginationCursorRequestFactory;
1313
use RuntimeException;
1414
use Symfony\Component\HttpFoundation\Request;
1515
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

src/OpenApi/SwaggerSchemasResponse.php renamed to src/Common/SwaggerSchemasResponse.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\OpenApi;
5+
namespace PhpList\RestBundle\Common;
66

77
use OpenApi\Attributes as OA;
88

src/Validator/RequestValidator.php renamed to src/Common/Validator/RequestValidator.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\Validator;
5+
namespace PhpList\RestBundle\Common\Validator;
66

7-
use PhpList\RestBundle\Entity\Request\RequestInterface;
7+
use PhpList\RestBundle\Common\Request\RequestInterface;
88
use Symfony\Component\HttpFoundation\Request;
99
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
1010
use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;

src/Controller/AdministratorController.php renamed to src/Identity/Controller/AdministratorController.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22

33
declare(strict_types=1);
44

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

77
use OpenApi\Attributes as OA;
88
use PhpList\Core\Domain\Identity\Model\Administrator;
99
use PhpList\Core\Domain\Identity\Service\AdministratorManager;
1010
use PhpList\Core\Security\Authentication;
11-
use PhpList\RestBundle\Entity\Request\CreateAdministratorRequest;
12-
use PhpList\RestBundle\Entity\Request\UpdateAdministratorRequest;
13-
use PhpList\RestBundle\Serializer\AdministratorNormalizer;
14-
use PhpList\RestBundle\Service\Provider\PaginatedDataProvider;
15-
use PhpList\RestBundle\Validator\RequestValidator;
11+
use PhpList\RestBundle\Common\Controller\BaseController;
12+
use PhpList\RestBundle\Common\Service\Provider\PaginatedDataProvider;
13+
use PhpList\RestBundle\Common\Validator\RequestValidator;
14+
use PhpList\RestBundle\Identity\Request\CreateAdministratorRequest;
15+
use PhpList\RestBundle\Identity\Request\UpdateAdministratorRequest;
16+
use PhpList\RestBundle\Identity\Serializer\AdministratorNormalizer;
1617
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
1718
use Symfony\Component\HttpFoundation\JsonResponse;
1819
use Symfony\Component\HttpFoundation\Request;

src/Controller/SessionController.php renamed to src/Identity/Controller/SessionController.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
declare(strict_types=1);
44

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

77
use OpenApi\Attributes as OA;
88
use PhpList\Core\Domain\Identity\Model\AdministratorToken;
99
use PhpList\Core\Domain\Identity\Service\SessionManager;
1010
use PhpList\Core\Security\Authentication;
11-
use PhpList\RestBundle\Entity\Request\CreateSessionRequest;
12-
use PhpList\RestBundle\Serializer\AdministratorTokenNormalizer;
13-
use PhpList\RestBundle\Validator\RequestValidator;
11+
use PhpList\RestBundle\Common\Controller\BaseController;
12+
use PhpList\RestBundle\Common\Validator\RequestValidator;
13+
use PhpList\RestBundle\Identity\Request\CreateSessionRequest;
14+
use PhpList\RestBundle\Identity\Serializer\AdministratorTokenNormalizer;
1415
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
1516
use Symfony\Component\HttpFoundation\JsonResponse;
1617
use Symfony\Component\HttpFoundation\Request;

0 commit comments

Comments
 (0)