Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update constructor to signify which parameters are required for sending all email #408

Merged
merged 5 commits into from
Jul 1, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/helpers/mail/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -948,12 +948,18 @@ class Mail implements \JsonSerializable

public function __construct($from = null, $subject = null, $to = null, $content = null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove the ability to set these to null since the helper will not work unless all of these parameters are set.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the user wants to create the object and then add personalizations separately, e.g. for sending to many recipients?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also what about using transactional templates where the subject isn't set programmatically at all?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Tzafra,

Would you mind opening up a new issue so that we can get better visibility on this issue?

{
if (!empty($from) && !empty($subject) && !empty($to) && !empty($content)) {
if (!empty($from)) {
$this->setFrom($from);
}
if (!empty($subject)) {
$this->setSubject($subject);
}
if (!empty($to)) {
$personalization = new Personalization();
$personalization->addTo($to);
$this->addPersonalization($personalization);
$this->setSubject($subject);
}
if (!empty($content)) {
$this->addContent($content);
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/SendGridTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function setUpBeforeClass()
exec($command, $op);
self::$pid = (int)$op[0];
sleep(15);
print("\nPrism Started");
print("\nPrism Started\n\n");
}

public function testHelloWorld()
Expand Down