Skip to content

Commit d2085ff

Browse files
committed
feature #47462 [Mime] Simplify adding Parts to an Email (fabpot)
This PR was merged into the 6.2 branch. Discussion ---------- [Mime] Simplify adding Parts to an Email | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | n/a <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | While fixing some MIME bugs, I realized we have a substantial cyclomatic complexity due to the attach/attachFromPath/embed/embedFromPath/attachPart methods on the Email class. This PR simplifies all of that and introduces a way to have a file for TextPart as well (via the new `file://` notation) and it keeps the lazy-loading feature which was why those methods were introduced in the first place. From now, I've kept all the methods, but I'm wondering if we should deprecate all of them and only keep `attachPart()` (which I would like to rename `addPart()`). Commits ------- 0a29d9703e [Mime] Simplify adding Parts to an Email
2 parents d8bd0a6 + a48fc79 commit d2085ff

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Normalizer/MimeMessageNormalizer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public function normalize(mixed $object, string $format = null, array $context =
6262
if ($object instanceof AbstractPart) {
6363
$ret = $this->normalizer->normalize($object, $format, $context);
6464
$ret['class'] = $object::class;
65+
unset($ret['seekable'], $ret['cid']);
6566

6667
return $ret;
6768
}

0 commit comments

Comments
 (0)