Skip to content

Commit c7a8c5e

Browse files
committed
Merge branch 'b-7.3.x-reafctor_static_methods-OXDEV-9047' into b-7.3.x
2 parents ea64e3c + 70ddf9f commit c7a8c5e

14 files changed

Lines changed: 50 additions & 51 deletions

File tree

CHANGELOG-v10.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [10.1.0] - unreleased
8-
9-
## Changed
10-
- Update module to work with OXID eShop 7.3
11-
127
## [10.0.0] - 2024-11-27
138
This is stable release for v10.0.0. No changes have been made since v10.0.0-rc.1.
149

@@ -45,6 +40,5 @@ This is stable release for v10.0.0. No changes have been made since v10.0.0-rc.1
4540
## Changed
4641
- Renamed OxidEsales\GraphQL\Base\Infrastructure\Token::cleanUpTokens() to deleteOrphanedTokens()
4742

48-
[10.1.0]: https://github.com/OXID-eSales/graphql-base-module/compare/v10.0.0...b-7.3.x
4943
[10.0.0]: https://github.com/OXID-eSales/graphql-base-module/compare/v10.0.0-rc.1...v10.0.0
5044
[10.0.0-rc.1]: https://github.com/OXID-eSales/graphql-base-module/compare/v9.0.0...v10.0.0-rc.1

CHANGELOG-v11.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [11.0.0] - unreleased
8+
9+
### Changed
10+
- Update module to work with OXID eShop 7.3
11+
- Replaced `TokenFilterList::fromUserInput` and `TokenSorting::fromUserInput` with direct object instantiation
12+
- Removed static access for `Legacy::createUniqueIdentifier()` and made it an instance method
13+
- Updated `MissingSignatureKey` exception to use a constructor instead of a static factory method
14+
15+
[11.0.0]: https://github.com/OXID-eSales/graphql-base-module/compare/v10.0.0...b-7.3.x

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
"oxid-esales/codeception-modules": "dev-b-7.3.x",
3131
"codeception/module-asserts": "^3.0"
3232
},
33-
"conflict": {
34-
"oxid-esales/oxideshop-ce": "<7.3"
35-
},
33+
"conflict": {
34+
"oxid-esales/oxideshop-ce": "<7.3"
35+
},
3636
"autoload": {
3737
"psr-4": {
3838
"OxidEsales\\GraphQL\\Base\\": "src"
@@ -76,7 +76,7 @@
7676
},
7777
"autoload-dev": {
7878
"psr-4": {
79-
"OxidEsales\\EshopCommunity\\Tests\\": "./vendor/oxid-esales/oxideshop-ce/tests",
79+
"OxidEsales\\EshopCommunity\\Tests\\": "./vendor/oxid-esales/oxideshop-ce/tests",
8080
"OxidEsales\\GraphQL\\Base\\Tests\\": "./tests"
8181
}
8282
}

src/Controller/Token.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,11 @@ public function tokens(
5353
?TokenSorting $sort = null
5454
): array {
5555
return $this->tokenAdministration->tokens(
56-
$filter ?? TokenFilterList::fromUserInput(
57-
new IDFilter(
58-
$this->authentication->getUser()->id()
59-
)
56+
$filter ?? new TokenFilterList(
57+
new IDFilter($this->authentication->getUser()->id())
6058
),
6159
$pagination ?? new Pagination(),
62-
$sort ?? TokenSorting::fromUserInput(Sorting::SORTING_ASC)
60+
$sort ?? new TokenSorting(Sorting::SORTING_ASC),
6361
);
6462
}
6563

src/DataType/Sorting/TokenSorting.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,21 @@
99

1010
namespace OxidEsales\GraphQL\Base\DataType\Sorting;
1111

12-
use TheCodingMachine\GraphQLite\Annotations\Factory;
12+
use TheCodingMachine\GraphQLite\Annotations\Field;
13+
use TheCodingMachine\GraphQLite\Annotations\Input;
1314

15+
#[Input]
1416
final class TokenSorting extends Sorting
1517
{
1618
/**
17-
* @Factory(name="TokenSorting",default=true)
18-
*
1919
* Tokens will be sorted by their expiration date ('expires_at' column).
2020
*/
21-
public static function fromUserInput(
22-
string $expiresAt = self::SORTING_ASC
23-
): self {
24-
return new self([
25-
'expires_at' => $expiresAt,
21+
public function __construct(
22+
#[Field]
23+
private string $expiresAt = self::SORTING_ASC,
24+
) {
25+
parent::__construct([
26+
'expires_at' => $this->expiresAt,
2627
]);
2728
}
2829
}

src/DataType/TokenFilterList.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,18 @@
1313
use OxidEsales\GraphQL\Base\DataType\Filter\DateFilter;
1414
use OxidEsales\GraphQL\Base\DataType\Filter\FilterListInterface;
1515
use OxidEsales\GraphQL\Base\DataType\Filter\IDFilter;
16-
use TheCodingMachine\GraphQLite\Annotations\Factory;
16+
use TheCodingMachine\GraphQLite\Annotations\Field;
17+
use TheCodingMachine\GraphQLite\Annotations\Input;
1718

19+
#[Input]
1820
final class TokenFilterList implements FilterListInterface
1921
{
2022
public function __construct(
23+
#[Field]
2124
private readonly ?IDFilter $customerId = null,
25+
#[Field]
2226
private readonly ?IDFilter $shopId = null,
27+
#[Field]
2328
private readonly ?DateFilter $expiresAt = null
2429
) {
2530
}
@@ -59,15 +64,4 @@ public function getFilters(): array
5964
'expires_at' => $this->expiresAt,
6065
];
6166
}
62-
63-
/**
64-
* @Factory(name="TokenFilterList",default=true)
65-
*/
66-
public static function fromUserInput(
67-
?IDFilter $customerId,
68-
?IDFilter $shopId = null,
69-
?DateFilter $expiresAt = null
70-
): self {
71-
return new self($customerId, $shopId, $expiresAt);
72-
}
7367
}

src/Exception/MissingSignatureKey.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class MissingSignatureKey extends Error
1313
{
1414
protected const WRONG_SIZE_MESSAGE = 'Signature key is too short';
1515

16-
public static function wrongSize(): self
16+
public function __construct()
1717
{
18-
return new self(self::WRONG_SIZE_MESSAGE);
18+
parent::__construct(self::WRONG_SIZE_MESSAGE);
1919
}
2020
}

src/Infrastructure/Legacy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function login(?string $username = null, ?string $password = null): UserI
4848
return new User($user, false);
4949
}
5050

51-
$user->setId(self::createUniqueIdentifier());
51+
$user->setId($this->createUniqueIdentifier());
5252
return new User($user, true);
5353
}
5454

@@ -126,7 +126,7 @@ public function getUserGroupIds(?string $userId): array
126126
return $userGroupIds;
127127
}
128128

129-
public static function createUniqueIdentifier(): string
129+
public function createUniqueIdentifier(): string
130130
{
131131
$utils = Registry::getUtilsObject();
132132
return $utils->generateUId();

src/Service/ModuleConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function getSignatureKey(): string
7777
->toString();
7878

7979
if (strlen($signature) < 64) {
80-
throw MissingSignatureKey::wrongSize();
80+
throw new MissingSignatureKey();
8181
}
8282

8383
return $signature;

src/Service/Token.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function createTokenForUser(UserInterface $user): UnencryptedToken
9292
->withClaim(self::CLAIM_USERNAME, $user->email())
9393
->withClaim(self::CLAIM_USERID, $user->id()->val())
9494
->withClaim(self::CLAIM_USER_ANONYMOUS, $user->isAnonymous())
95-
->withClaim(self::CLAIM_TOKENID, Legacy::createUniqueIdentifier());
95+
->withClaim(self::CLAIM_TOKENID, $this->legacyInfrastructure->createUniqueIdentifier());
9696

9797
$event = new BeforeTokenCreation($builder, $user);
9898
$this->eventDispatcher->dispatch(

0 commit comments

Comments
 (0)