Skip to content

Commit ab87ef5

Browse files
feat: shopware 6.7 (#114)
1 parent b98725a commit ab87ef5

Some content is hidden

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

41 files changed

+657
-405
lines changed

.github/workflows/code-style.yml

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,36 @@
11
name: Code Style
22
on:
3-
workflow_dispatch:
4-
pull_request:
5-
push:
6-
branches:
7-
- main
3+
workflow_dispatch:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
88

99
jobs:
10-
cs:
11-
if: github.event_name != 'schedule'
12-
uses: shopware/github-actions/.github/workflows/cs-fixer.yml@main
13-
phpstan:
14-
uses: shopware/github-actions/.github/workflows/phpstan.yml@main
10+
cs:
11+
if: github.event_name != 'schedule'
12+
runs-on: ubuntu-24.04
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Run CS
18+
uses: shopware/github-actions/extension-verifier@main
19+
with:
20+
action: format
21+
22+
check:
23+
runs-on: ubuntu-24.04
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
version-selection: [ 'lowest', 'highest']
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Run Check
33+
uses: shopware/github-actions/extension-verifier@main
1534
with:
16-
extensionName: FroshTools
17-
shopwareVersion: v6.6.0.0-rc1
35+
action: check
36+
check-against: ${{ matrix.version-selection }}

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ frosh-platform-mail-archive.js
66
/vendor/
77
/src/Resources/public/
88
/composer.lock
9-
.php-cs-fixer.cache
9+
.php-cs-fixer.cache
10+
11+
src/Resources/app/administration/src/.vite
12+
src/Resources/public
13+

composer.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "frosh/mail-platform-archive",
3-
"version": "3.5.0",
3+
"version": "3.5.1",
44
"description": "Mail Archive",
55
"type": "shopware-platform-plugin",
66
"license": "MIT",
@@ -40,12 +40,16 @@
4040
}
4141
},
4242
"require": {
43-
"shopware/core": "~6.6.0",
43+
"shopware/core": "~6.6.0 || ~6.7.0",
4444
"zbateson/mail-mime-parser": "^2.4"
4545
},
4646
"config": {
4747
"allow-plugins": {
4848
"symfony/runtime": true
4949
}
50+
},
51+
"scripts": {
52+
"format": "docker run --rm -v $(pwd):/ext shopware/shopware-cli:latest extension format /ext",
53+
"check": "docker run --rm -v $(pwd):/ext shopware/shopware-cli:latest extension validate --full /ext"
5054
}
5155
}

phpstan.neon.dist

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
parameters:
2+
reportUnmatchedIgnoredErrors: false
23
level: max
34
paths:
45
- src
5-
type_coverage:
6-
return_type: 100
7-
param_type: 98
8-
property_type: 100

qodana.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/Content/MailArchive/MailArchiveAttachmentEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class MailArchiveAttachmentEntity extends Entity
1313

1414
protected string $mailArchiveId;
1515

16-
protected ?MailArchiveEntity $mailArchive;
16+
protected ?MailArchiveEntity $mailArchive = null;
1717

1818
protected string $fileName;
1919

src/Content/MailArchive/MailArchiveDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected function defineFields(): FieldCollection
5757
(new StringField('subject', 'subject', 998))->addFlags(new Required())->addFlags(new SearchRanking(SearchRanking::HIGH_SEARCH_RANKING)),
5858
(new LongTextField('plainText', 'plainText'))->addFlags(new AllowHtml()),
5959
(new LongTextField('htmlText', 'htmlText'))->addFlags(new AllowHtml(), new SearchRanking(SearchRanking::LOW_SEARCH_RANKING)),
60-
(new StringField('eml_path', 'emlPath', 2048)),
60+
new StringField('eml_path', 'emlPath', 2048),
6161
(new StringField('transport_state', 'transportState'))->addFlags(new Required()),
6262

6363
(new OneToManyAssociationField('attachments', MailArchiveAttachmentDefinition::class, 'mail_archive_id', 'id'))->addFlags(new CascadeDelete()),

src/Content/MailArchive/MailArchiveEntity.php

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,55 +16,58 @@ class MailArchiveEntity extends Entity
1616
{
1717
use EntityIdTrait;
1818

19-
/** @var array<string, string> */
19+
/**
20+
* @var array<string, string>
21+
*/
2022
protected array $sender;
2123

22-
/** @var array<string, string> */
24+
/**
25+
* @var array<string, string>
26+
*/
2327
protected array $receiver;
2428

2529
protected string $subject;
2630

27-
protected ?string $plainText;
31+
protected ?string $plainText = null;
2832

29-
protected ?string $htmlText;
33+
protected ?string $htmlText = null;
3034

31-
protected ?string $transportState;
35+
protected ?string $transportState = null;
3236

33-
protected ?string $emlPath;
37+
protected ?string $emlPath = null;
3438

35-
protected ?string $salesChannelId;
39+
protected ?string $salesChannelId = null;
3640

37-
protected ?SalesChannelEntity $salesChannel;
41+
protected ?SalesChannelEntity $salesChannel = null;
3842

39-
protected ?string $customerId;
43+
protected ?string $customerId = null;
4044

41-
protected ?CustomerEntity $customer;
45+
protected ?CustomerEntity $customer = null;
4246

43-
protected ?string $orderId;
47+
protected ?string $orderId = null;
4448

45-
protected ?string $orderVersionId;
49+
protected ?string $orderVersionId = null;
4650

47-
protected ?OrderEntity $order;
51+
protected ?OrderEntity $order = null;
4852

49-
protected ?string $flowId;
53+
protected ?string $flowId = null;
5054

51-
protected ?FlowEntity $flow;
55+
protected ?FlowEntity $flow = null;
5256

5357
/**
5458
* @var EntityCollection<MailArchiveAttachmentEntity>|null
5559
*/
5660
protected ?EntityCollection $attachments = null;
5761

58-
protected ?string $sourceMailId;
62+
protected ?string $sourceMailId = null;
5963

60-
protected ?MailArchiveEntity $sourceMail;
64+
protected ?MailArchiveEntity $sourceMail = null;
6165

6266
/**
6367
* @var EntityCollection<MailArchiveEntity>|null
6468
*/
6569
protected ?EntityCollection $sourceMails = null;
6670

67-
6871
/**
6972
* @return array<string, string>
7073
*/
@@ -288,5 +291,4 @@ public function setOrderVersionId(?string $orderVersionId): void
288291
{
289292
$this->orderVersionId = $orderVersionId;
290293
}
291-
292294
}

src/Controller/Api/MailArchiveController.php

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
use Symfony\Component\HttpFoundation\RequestStack;
2424
use Symfony\Component\Mime\Address;
2525
use Symfony\Component\Mime\Email;
26-
use Symfony\Component\Routing\Annotation\Route;
26+
use Symfony\Component\Routing\Attribute\Route;
2727
use ZBateson\MailMimeParser\Header\AddressHeader;
2828
use ZBateson\MailMimeParser\Header\DateHeader;
2929
use ZBateson\MailMimeParser\Header\IHeader;
@@ -37,13 +37,14 @@ class MailArchiveController extends AbstractController
3737
* @param EntityRepository<EntityCollection<MailArchiveAttachmentEntity>> $froshMailArchiveAttachmentRepository
3838
*/
3939
public function __construct(
40-
private readonly EntityRepository $froshMailArchiveRepository,
41-
private readonly EntityRepository $froshMailArchiveAttachmentRepository,
40+
private readonly EntityRepository $froshMailArchiveRepository,
41+
private readonly EntityRepository $froshMailArchiveAttachmentRepository,
4242
#[Autowire(service: MailSender::class)]
4343
private readonly AbstractMailSender $mailSender,
44-
private readonly RequestStack $requestStack,
45-
private readonly EmlFileManager $emlFileManager,
46-
) {}
44+
private readonly RequestStack $requestStack,
45+
private readonly EmlFileManager $emlFileManager,
46+
) {
47+
}
4748

4849
#[Route(path: '/api/_action/frosh-mail-archive/resend-mail', name: 'api.action.frosh-mail-archive.resend-mail')]
4950
public function resend(Request $request, Context $context): JsonResponse
@@ -68,7 +69,7 @@ public function resend(Request $request, Context $context): JsonResponse
6869

6970
$email = new Email();
7071
$emlPath = $mailArchive->getEmlPath();
71-
$isEml = !empty($emlPath) && \is_string($emlPath);
72+
$isEml = $emlPath !== '' && $emlPath !== '0' && \is_string($emlPath);
7273

7374
if ($isEml) {
7475
$this->enrichFromEml($emlPath, $email);
@@ -110,7 +111,7 @@ public function download(Request $request, Context $context): JsonResponse
110111

111112
$fileNameParts = [];
112113

113-
if ($mailArchive->getCreatedAt() !== null) {
114+
if ($mailArchive->getCreatedAt() instanceof \DateTimeInterface) {
114115
$fileNameParts[] = $mailArchive->getCreatedAt()->format('Y-m-d_H-i-s');
115116
}
116117

@@ -147,7 +148,7 @@ public function attachment(Request $request, Context $context): JsonResponse
147148
}
148149

149150
$emlPath = $mailArchive->getEmlPath();
150-
$isEml = !empty($emlPath) && \is_string($emlPath);
151+
$isEml = $emlPath !== '' && $emlPath !== '0' && \is_string($emlPath);
151152

152153
if (!$isEml) {
153154
throw new \RuntimeException('Cannot read eml file or file is empty');
@@ -175,7 +176,7 @@ public function attachment(Request $request, Context $context): JsonResponse
175176

176177
$fileNameParts = [];
177178

178-
if ($mailArchive->getCreatedAt() !== null) {
179+
if ($mailArchive->getCreatedAt() instanceof \DateTimeInterface) {
179180
$fileNameParts[] = $mailArchive->getCreatedAt()->format('Y-m-d_H-i-s');
180181
}
181182

@@ -250,7 +251,7 @@ private function enrichFromDatabase(MailArchiveEntity $mailArchive, Email $email
250251
/**
251252
* @return string|array<string|Address>|\DateTimeImmutable|null
252253
*/
253-
private function getHeaderValue(IHeader $header): string|array|null|\DateTimeImmutable
254+
private function getHeaderValue(IHeader $header): string|array|\DateTimeImmutable|null
254255
{
255256
if ($header instanceof AddressHeader) {
256257
/** @var AddressPart[] $addressParts */
@@ -286,7 +287,7 @@ private function getFileName(array $fileNameParts): string
286287

287288
private function getContent(?string $emlPath): false|string
288289
{
289-
if (empty($emlPath) || !\is_string($emlPath)) {
290+
if ($emlPath === '' || $emlPath === '0' || !\is_string($emlPath)) {
290291
return false;
291292
}
292293

@@ -299,7 +300,7 @@ private function getContent(?string $emlPath): false|string
299300
private function determineReturnPath(\DateTimeImmutable|array|string|null $headerValue): ?string
300301
{
301302
// Extract first item for return-path since Symfony/Mailer needs to be a string value here
302-
if (is_array($headerValue)) {
303+
if (\is_array($headerValue)) {
303304
$headerValue = array_pop($headerValue);
304305
}
305306

@@ -309,15 +310,15 @@ private function determineReturnPath(\DateTimeImmutable|array|string|null $heade
309310
return $headerValue->getEncodedAddress();
310311
}
311312

312-
if (is_string($headerValue)) {
313+
if (\is_string($headerValue)) {
313314
$regex = '/[<"]([^<>"\s]+@[^<>"\s]+)[>"]/';
314315
preg_match($regex, $headerValue, $matches);
315316
if (isset($matches[1])) {
316317
$headerValue = $matches[1];
317318
}
318319
}
319320

320-
if (is_string($headerValue)) {
321+
if (\is_string($headerValue)) {
321322
try {
322323
return (new Address($headerValue))->getEncodedAddress();
323324
} catch (\Throwable) {

src/Extension/Checkout/Customer/CustomerExtension.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ public function extendFields(FieldCollection $collection): void
2626
);
2727
}
2828

29+
public function getEntityName(): string
30+
{
31+
return CustomerDefinition::ENTITY_NAME;
32+
}
33+
2934
public function getDefinitionClass(): string
3035
{
3136
return CustomerDefinition::class;

0 commit comments

Comments
 (0)