Skip to content
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

Update to php8.1 symfony 6.4 #141

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
dad3a20
change branch name
xh3n1 Mar 5, 2019
9e4e996
Disable REST API by default
xh3n1 Mar 6, 2019
7d2145f
Change path
xh3n1 Mar 26, 2019
81fd339
Remove prefix
xh3n1 Apr 4, 2019
30fde0d
[FEATURE] Get the number of subscribers of list and added tests (#116)
xh3n1 May 31, 2019
8fca0ef
[BUGFIX] Fix the expected number in an integration test (#119)
xh3n1 May 31, 2019
4364ded
[CLEANUP] Fix a warning with newer PHPMD versions (#125)
Dec 5, 2019
26ea3c8
update php dependencies
michield Oct 4, 2022
110b25d
update to pass building
michield Feb 9, 2023
c07cee1
ISSUE-337: update package versions
tatevikg1 Nov 24, 2024
b687537
ISSUE-337: use local
tatevikg1 Nov 24, 2024
85ab9ce
ISSUE-337: symfony 6.4
tatevikg1 Nov 30, 2024
f09b1f9
ISSUE-337: test fix
tatevikg1 Dec 5, 2024
bf004d0
ISSUE-337: fix the rest of tests
tatevikg1 Dec 10, 2024
86b26f6
GitHub actions (#132)
nfebe Feb 11, 2021
a35a7d5
ISSUE-337: add pipeline
tatevikg1 Dec 11, 2024
276d397
ISSUE-337: fix phpstan
tatevikg1 Dec 11, 2024
acec73c
ISSUE-337: fix phpstmd
tatevikg1 Dec 11, 2024
3453581
ISSUE-337: openapi docs
tatevikg1 Dec 12, 2024
1986e45
merge main
tatevikg1 Dec 12, 2024
2e8300a
ISSUE-337: move to bundle file
tatevikg1 Dec 12, 2024
b483207
ISSUE-337: changelog
tatevikg1 Dec 14, 2024
884fb1e
ISSUE-337: update core
tatevikg1 Dec 15, 2024
8ad8004
ISSUE-337: fix phpstan
tatevikg1 Dec 15, 2024
7502393
ISSUE-337: fix phpcs
tatevikg1 Dec 15, 2024
1e4294c
ISSUE-337: force push
tatevikg1 Dec 15, 2024
2ce9ae1
ISSUE-337: name fix
tatevikg1 Dec 16, 2024
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
Prev Previous commit
Next Next commit
ISSUE-337: add pipeline
  • Loading branch information
tatevikg1 committed Dec 11, 2024
commit a35a7d54ef288ccb053b832a924bbd70c8bd6420
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
php-versions: ['8.1']
dependencies: ['latest', 'oldest']
steps:
- name: Checkout
@@ -63,10 +63,10 @@ jobs:
- name: Run integration tests with phpunit
run: vendor/bin/phpunit tests/Integration/
- name: Running the system tests
run: vendor/bin/phpunit tests/Integration/;
run: vendor/bin/phpunit tests/System/;
- name: Running static analysis
run: vendor/bin/phpstan analyse -l 5 src/ tests/;
- name: Running PHPMD
run: vendor/bin/phpmd src/ text vendor/phplist/core/config/PHPMD/rules.xml;
- name: Running PHP_CodeSniffer
run: vendor/bin/phpcs --standard=vendor/phplist/core/config/PhpCodeSniffer/ src/ tests/;
run: vendor/bin/phpcs --standard=vendor/phplist/core/config/PhpCodeSniffer/ src/ tests/;
Empty file removed .travis.yml
Empty file.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@
"phpunit/phpunit": "^10.0",
"guzzlehttp/guzzle": "^6.3.0",
"squizlabs/php_codesniffer": "^3.2.0",
"phpstan/phpstan": "^0.12.57",
"phpstan/phpstan": "^1.10",
"nette/caching": "^3.0.0",
"nikic/php-parser": "^4.19.1",
"phpmd/phpmd": "^2.6.0",
@@ -86,7 +86,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "5.0.x-dev"
"dev-ISSUE-337": "5.0.x-dev"
},
"symfony-app-dir": "bin",
"symfony-bin-dir": "bin",
21 changes: 14 additions & 7 deletions src/Controller/ListController.php
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@

use PhpList\Core\Domain\Model\Messaging\SubscriberList;
use PhpList\Core\Domain\Repository\Subscription\SubscriberRepository;
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use PhpList\Core\Domain\Repository\Messaging\SubscriberListRepository;
use PhpList\Core\Security\Authentication;
@@ -62,7 +63,7 @@ public function getLists(Request $request): JsonResponse
}

#[Route('/lists/{id}', name: 'get_list', methods: ['GET'])]
public function getList(Request $request, SubscriberList $list): JsonResponse
public function getList(Request $request, #[MapEntity(mapping: ['id' => 'id'])] SubscriberList $list): JsonResponse
{
$this->requireAuthentication($request);
$json = $this->serializer->serialize($list, 'json', [
@@ -73,8 +74,10 @@ public function getList(Request $request, SubscriberList $list): JsonResponse
}

#[Route('/lists/{id}', name: 'delete_list', methods: ['DELETE'])]
public function deleteList(Request $request, SubscriberList $list): JsonResponse
{
public function deleteList(
Request $request,
#[MapEntity(mapping: ['id' => 'id'])] SubscriberList $list
): JsonResponse {
$this->requireAuthentication($request);

$this->subscriberListRepository->remove($list);
@@ -83,8 +86,10 @@ public function deleteList(Request $request, SubscriberList $list): JsonResponse
}

#[Route('/lists/{id}/members', name: 'get_subscriber_from_list', methods: ['GET'])]
public function getListMembers(Request $request, SubscriberList $list): JsonResponse
{
public function getListMembers(
Request $request,
#[MapEntity(mapping: ['id' => 'id'])] SubscriberList $list
): JsonResponse {
$this->requireAuthentication($request);

$subscribers = $this->subscriberRepository->getSubscribersBySubscribedListId($list->getId());
@@ -97,8 +102,10 @@ public function getListMembers(Request $request, SubscriberList $list): JsonResp
}

#[Route('/lists/{id}/subscribers/count', name: 'get_subscribers_count_from_list', methods: ['GET'])]
public function getSubscribersCount(Request $request, SubscriberList $list): JsonResponse
{
public function getSubscribersCount(
Request $request,
#[MapEntity(mapping: ['id' => 'id'])] SubscriberList $list
): JsonResponse {
$this->requireAuthentication($request);
$json = $this->serializer->serialize(count($list->getSubscribers()), 'json');

8 changes: 5 additions & 3 deletions src/Controller/SessionController.php
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@

namespace PhpList\RestBundle\Controller;

use Symfony\Bridge\Doctrine\Attribute\MapEntity;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use PhpList\Core\Domain\Model\Identity\Administrator;
use PhpList\Core\Domain\Model\Identity\AdministratorToken;
@@ -24,7 +25,6 @@
* This controller provides methods to create and destroy REST API sessions.
*
* @author Oliver Klee <[email protected]>
* @author Tatevik Grigoryan <[email protected]>
*/
class SessionController extends AbstractController
{
@@ -83,8 +83,10 @@ public function createSession(Request $request): JsonResponse
* @throws AccessDeniedHttpException
*/
#[Route('/sessions/{id}', name: 'delete_session', methods: ['DELETE'])]
public function deleteAction(Request $request, AdministratorToken $token): JsonResponse
{
public function deleteAction(
Request $request,
#[MapEntity(mapping: ['id' => 'id'])] AdministratorToken $token
): JsonResponse {
$administrator = $this->requireAuthentication($request);
if ($token->getAdministrator() !== $administrator) {
throw new AccessDeniedHttpException('You do not have access to this session.', null, 1519831644);
8 changes: 5 additions & 3 deletions src/Controller/SubscriberController.php
Original file line number Diff line number Diff line change
@@ -68,9 +68,11 @@ public function postAction(Request $request): JsonResponse
$subscriber->setDisabled((bool)$data->get('disabled'));
$this->subscriberRepository->save($subscriber);

$json = $this->serializer->serialize($subscriber, 'json');

return new JsonResponse($json, Response::HTTP_CREATED, [], true);
return new JsonResponse(
$this->serializer->serialize($subscriber, 'json'),
Response::HTTP_CREATED, [],
true
);
}

/**
3 changes: 0 additions & 3 deletions src/DependencyInjection/PhpListRestExtension.php
Original file line number Diff line number Diff line change
@@ -30,9 +30,6 @@ class PhpListRestExtension extends Extension
*/
public function load(array $configs, ContainerBuilder $container): void
{
// This parameter is unused, but not optional. This line will avoid a static analysis warning this.
$configs;

$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../../config'));
$loader->load('services.yml');
}