Skip to content
Snippets Groups Projects

Issue #3382624 by adamps: embed attachments adjustment for 2.x

4 files
+ 19
34
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 3
9
@@ -257,7 +257,6 @@ class BaseEmail implements BaseEmailInterface {
* {@inheritdoc}
*/
public function attachFromPath(string $path, ?string $name = NULL, ?string $mimeType = NULL) {
@trigger_error('\Drupal\symfony_mailer\Email::attachFromPath() is deprecated in symfony_mailer:1.6.0 and is removed from symfony_mailer:2.0.0. Use ::attach() instead. See https://www.drupal.org/node/3476132', E_USER_DEPRECATED);
return $this->attach(Attachment::fromPath($path, $name, $mimeType));
}
@@ -274,13 +273,8 @@ class BaseEmail implements BaseEmailInterface {
*/
public function attach(AttachmentInterface $attachment): static {
$this->valid();
if ($uri = $attachment->getUri()) {
$this->attachments[$uri] = $attachment;
}
else {
$this->attachments[] = $attachment;
}
$key = $attachment->getUri() ?: $attachment->getContentId();
$this->attachments[$key] = $attachment;
return $this;
}
@@ -294,7 +288,7 @@ class BaseEmail implements BaseEmailInterface {
/**
* {@inheritdoc}
*/
public function removeAttachment($key): static {
public function removeAttachment(string $key): static {
$this->valid();
unset($this->attachments[$key]);
return $this;
Loading