update
This commit is contained in:
@@ -119,4 +119,24 @@ final class EmailTemplateRepository
|
||||
);
|
||||
$statement->execute(['id' => $id]);
|
||||
}
|
||||
|
||||
public function duplicate(int $id): void
|
||||
{
|
||||
$source = $this->findById($id);
|
||||
if ($source === null) {
|
||||
throw new \RuntimeException('Szablon nie istnieje');
|
||||
}
|
||||
|
||||
$statement = $this->pdo->prepare(
|
||||
'INSERT INTO email_templates (name, subject, body_html, mailbox_id, attachment_1, is_active)
|
||||
VALUES (:name, :subject, :body_html, :mailbox_id, :attachment_1, 0)'
|
||||
);
|
||||
$statement->execute([
|
||||
'name' => 'Kopia — ' . $source['name'],
|
||||
'subject' => $source['subject'],
|
||||
'body_html' => $source['body_html'],
|
||||
'mailbox_id' => $source['mailbox_id'],
|
||||
'attachment_1' => $source['attachment_1'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user