Skip to content

ISSUE-345 #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"require": {
"php": "^8.1",
"phplist/core": "v5.0.0-alpha6",
"phplist/core": "v5.0.0-alpha7",
"friendsofsymfony/rest-bundle": "*",
"symfony/test-pack": "^1.0",
"symfony/process": "^6.4",
Expand Down Expand Up @@ -97,8 +97,18 @@
"PhpList\\RestBundle\\PhpListRestBundle"
],
"routes": {
"rest-api": {
"resource": "@PhpListRestBundle/Controller/",
"rest-api-identity": {
"resource": "@PhpListRestBundle/Identity/Controller/",
"type": "attribute",
"prefix": "/api/v2"
},
"rest-api-subscription": {
"resource": "@PhpListRestBundle/Subscription/Controller/",
"type": "attribute",
"prefix": "/api/v2"
},
"rest-api-messaging": {
"resource": "@PhpListRestBundle/Messaging/Controller/",
"type": "attribute",
"prefix": "/api/v2"
}
Expand Down
6 changes: 0 additions & 6 deletions config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ services:
Psr\Container\ContainerInterface:
alias: 'service_container'

PhpList\RestBundle\Controller\:
resource: '../src/Controller'
public: true
autowire: true
tags: ['controller.service_arguments']

my.secure_handler:
class: PhpList\RestBundle\ViewHandler\SecuredViewHandler

Expand Down
10 changes: 5 additions & 5 deletions config/services/builders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ services:
autoconfigure: true
public: false

PhpList\RestBundle\Service\Builder\MessageBuilder:
PhpList\Core\Domain\Messaging\Service\Builder\MessageBuilder:
autowire: true
autoconfigure: true

PhpList\RestBundle\Service\Builder\MessageFormatBuilder:
PhpList\Core\Domain\Messaging\Service\Builder\MessageFormatBuilder:
autowire: true
autoconfigure: true

PhpList\RestBundle\Service\Builder\MessageScheduleBuilder:
PhpList\Core\Domain\Messaging\Service\Builder\MessageScheduleBuilder:
autowire: true
autoconfigure: true

PhpList\RestBundle\Service\Builder\MessageContentBuilder:
PhpList\Core\Domain\Messaging\Service\Builder\MessageContentBuilder:
autowire: true
autoconfigure: true

PhpList\RestBundle\Service\Builder\MessageOptionsBuilder:
PhpList\Core\Domain\Messaging\Service\Builder\MessageOptionsBuilder:
autowire: true
autoconfigure: true
26 changes: 26 additions & 0 deletions config/services/controllers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false

PhpList\RestBundle\Identity\Controller\:
resource: '../src/Identity/Controller'
tags: [ 'controller.service_arguments' ]
autowire: true
autoconfigure: true
public: true

PhpList\RestBundle\Messaging\Controller\:
resource: '../src/Messaging/Controller'
tags: [ 'controller.service_arguments' ]
autowire: true
autoconfigure: true
public: true

PhpList\RestBundle\Subscription\Controller\:
resource: '../src/Subscription/Controller'
tags: [ 'controller.service_arguments' ]
autowire: true
autoconfigure: true
public: true
2 changes: 1 addition & 1 deletion config/services/factories.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ services:
autoconfigure: true
public: false

PhpList\RestBundle\Service\Factory\PaginationCursorRequestFactory:
PhpList\RestBundle\Common\Service\Factory\PaginationCursorRequestFactory:
autowire: true
autoconfigure: true
4 changes: 2 additions & 2 deletions config/services/listeners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ services:
autoconfigure: true
public: false

PhpList\RestBundle\EventListener\ExceptionListener:
PhpList\RestBundle\Common\EventListener\ExceptionListener:
tags:
- { name: kernel.event_listener, event: kernel.exception }

PhpList\RestBundle\EventListener\ResponseListener:
PhpList\RestBundle\Common\EventListener\ResponseListener:
tags:
- { name: kernel.event_listener, event: kernel.response }
20 changes: 12 additions & 8 deletions config/services/managers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,38 @@ services:
autoconfigure: true
public: false

PhpList\RestBundle\Service\Manager\SubscriberManager:
PhpList\Core\Domain\Subscription\Service\Manager\SubscriberManager:
autowire: true
autoconfigure: true

PhpList\RestBundle\Service\Manager\SessionManager:
PhpList\Core\Domain\Identity\Service\SessionManager:
autowire: true
autoconfigure: true

PhpList\RestBundle\Service\Manager\SubscriberListManager:
PhpList\Core\Domain\Subscription\Service\Manager\SubscriberListManager:
autowire: true
autoconfigure: true

PhpList\RestBundle\Service\Manager\SubscriptionManager:
PhpList\Core\Domain\Subscription\Service\Manager\SubscriptionManager:
autowire: true
autoconfigure: true

PhpList\RestBundle\Service\Manager\MessageManager:
PhpList\Core\Domain\Messaging\Service\MessageManager:
autowire: true
autoconfigure: true

PhpList\RestBundle\Service\Manager\TemplateManager:
PhpList\Core\Domain\Messaging\Service\TemplateManager:
autowire: true
autoconfigure: true

PhpList\RestBundle\Service\Manager\TemplateImageManager:
PhpList\Core\Domain\Messaging\Service\TemplateImageManager:
autowire: true
autoconfigure: true

PhpList\RestBundle\Service\Manager\AdministratorManager:
PhpList\Core\Domain\Identity\Service\AdministratorManager:
autowire: true
autoconfigure: true

PhpList\Core\Domain\Subscription\Service\SubscriberCsvExporter:
autowire: true
autoconfigure: true
42 changes: 33 additions & 9 deletions config/services/normalizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,61 @@ services:
$classMetadataFactory: '@?serializer.mapping.class_metadata_factory'
$nameConverter: '@Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter'

PhpList\RestBundle\Serializer\SubscriberNormalizer:
PhpList\RestBundle\Subscription\Serializer\SubscriberNormalizer:
tags: [ 'serializer.normalizer' ]
autowire: true

PhpList\RestBundle\Serializer\AdministratorTokenNormalizer:
PhpList\RestBundle\Subscription\Serializer\SubscriberOnlyNormalizer:
tags: [ 'serializer.normalizer' ]
autowire: true

PhpList\RestBundle\Serializer\SubscriberListNormalizer:
PhpList\RestBundle\Identity\Serializer\AdministratorTokenNormalizer:
tags: [ 'serializer.normalizer' ]
autowire: true

PhpList\RestBundle\Serializer\SubscriptionNormalizer:
PhpList\RestBundle\Subscription\Serializer\SubscriberListNormalizer:
tags: [ 'serializer.normalizer' ]
autowire: true

PhpList\RestBundle\Serializer\MessageNormalizer:
PhpList\RestBundle\Subscription\Serializer\SubscriptionNormalizer:
tags: [ 'serializer.normalizer' ]
autowire: true

PhpList\RestBundle\Serializer\TemplateImageNormalizer:
PhpList\RestBundle\Messaging\Serializer\MessageNormalizer:
tags: [ 'serializer.normalizer' ]
autowire: true

PhpList\RestBundle\Serializer\TemplateNormalizer:
PhpList\RestBundle\Messaging\Serializer\TemplateImageNormalizer:
tags: [ 'serializer.normalizer' ]
autowire: true

PhpList\RestBundle\Serializer\AdministratorNormalizer:
PhpList\RestBundle\Messaging\Serializer\TemplateNormalizer:
tags: [ 'serializer.normalizer' ]
autowire: true

PhpList\RestBundle\Serializer\CursorPaginationNormalizer:
PhpList\RestBundle\Identity\Serializer\AdministratorNormalizer:
tags: [ 'serializer.normalizer' ]
autowire: true

PhpList\RestBundle\Identity\Serializer\AdminAttributeDefinitionNormalizer:
tags: [ 'serializer.normalizer' ]
autowire: true

PhpList\RestBundle\Identity\Serializer\AdminAttributeValueNormalizer:
tags: [ 'serializer.normalizer' ]
autowire: true

PhpList\RestBundle\Subscription\Serializer\AttributeDefinitionNormalizer:
tags: [ 'serializer.normalizer' ]
autowire: true

PhpList\RestBundle\Subscription\Serializer\SubscriberAttributeValueNormalizer:
tags: [ 'serializer.normalizer' ]
autowire: true

PhpList\RestBundle\Common\Serializer\CursorPaginationNormalizer:
autowire: true

PhpList\RestBundle\Subscription\Serializer\SubscribersExportRequestNormalizer:
tags: [ 'serializer.normalizer' ]
autowire: true
2 changes: 1 addition & 1 deletion config/services/providers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ services:
autoconfigure: true
public: false

PhpList\RestBundle\Service\Provider\PaginatedDataProvider:
PhpList\RestBundle\Common\Service\Provider\PaginatedDataProvider:
autowire: true
autoconfigure: true
22 changes: 12 additions & 10 deletions config/services/validators.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
services:
PhpList\RestBundle\Validator\RequestValidator:
PhpList\RestBundle\Common\Validator\RequestValidator:
autowire: true
autoconfigure: true
public: false

PhpList\RestBundle\Validator\Constraint\UniqueEmailValidator:
PhpList\RestBundle\Identity\Validator\Constraint\UniqueEmailValidator:
autowire: true
autoconfigure: true
tags: [ 'validator.constraint_validator' ]

PhpList\RestBundle\Validator\Constraint\EmailExistsValidator:
PhpList\RestBundle\Subscription\Validator\Constraint\UniqueEmailValidator:
autowire: true
autoconfigure: true
tags: [ 'validator.constraint_validator' ]

PhpList\RestBundle\Validator\Constraint\TemplateExistsValidator:
PhpList\RestBundle\Subscription\Validator\Constraint\EmailExistsValidator:
autowire: true
autoconfigure: true
tags: [ 'validator.constraint_validator' ]

PhpList\RestBundle\Validator\TemplateLinkValidator:
PhpList\RestBundle\Messaging\Validator\Constraint\TemplateExistsValidator:
autowire: true
autoconfigure: true
tags: [ 'validator.constraint_validator' ]

PhpList\RestBundle\Messaging\Validator\Constraint\ContainsPlaceholderValidator:
tags: ['validator.constraint_validator']

PhpList\RestBundle\Validator\TemplateImageValidator:
PhpList\RestBundle\Identity\Validator\Constraint\UniqueLoginNameValidator:
autowire: true
autoconfigure: true
tags: [ 'validator.constraint_validator' ]

PhpList\RestBundle\Validator\Constraint\ContainsPlaceholderValidator:
tags: ['validator.constraint_validator']

PhpList\RestBundle\Validator\Constraint\UniqueLoginNameValidator:
PhpList\RestBundle\Subscription\Validator\Constraint\ListExistsValidator:
autowire: true
autoconfigure: true
tags: [ 'validator.constraint_validator' ]
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace PhpList\RestBundle\Controller;
namespace PhpList\RestBundle\Common\Controller;

use PhpList\Core\Domain\Model\Identity\Administrator;
use PhpList\Core\Domain\Identity\Model\Administrator;
use PhpList\Core\Security\Authentication;
use PhpList\RestBundle\Validator\RequestValidator;
use PhpList\RestBundle\Common\Validator\RequestValidator;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace PhpList\RestBundle\Entity\Dto;
namespace PhpList\RestBundle\Common\Dto;

class CursorPaginationResult
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace PhpList\RestBundle\Entity\Dto;
namespace PhpList\RestBundle\Common\Dto;

class ValidationContext
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace PhpList\RestBundle\EventListener;
namespace PhpList\RestBundle\Common\EventListener;

use Exception;
use PhpList\RestBundle\Exception\SubscriptionCreationException;
use PhpList\Core\Domain\Subscription\Exception\SubscriptionCreationException;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace PhpList\RestBundle\EventListener;
namespace PhpList\RestBundle\Common\EventListener;

use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace PhpList\RestBundle\Entity\Request;
namespace PhpList\RestBundle\Common\Request;

use Symfony\Component\HttpFoundation\Request;

Expand Down
10 changes: 10 additions & 0 deletions src/Common/Request/RequestInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace PhpList\RestBundle\Common\Request;

interface RequestInterface
{
public function getDto(): mixed;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace PhpList\RestBundle\Serializer;
namespace PhpList\RestBundle\Common\Serializer;

use PhpList\RestBundle\Entity\Dto\CursorPaginationResult;
use PhpList\RestBundle\Common\Dto\CursorPaginationResult;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class CursorPaginationNormalizer implements NormalizerInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace PhpList\RestBundle\Service\Factory;
namespace PhpList\RestBundle\Common\Service\Factory;

use PhpList\RestBundle\Entity\Request\PaginationCursorRequest;
use PhpList\RestBundle\Common\Request\PaginationCursorRequest;
use Symfony\Component\HttpFoundation\Request;

class PaginationCursorRequestFactory
Expand Down
Loading
Loading