Skip to content

[Swiftmailer] create Message by mailer service. #4884

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

Closed
wants to merge 1 commit into from

Conversation

aitboudad
Copy link
Contributor

Q A
Doc fix? yes
New docs? no
Applies to all

It complete the PR: #4808

@stof
Copy link
Member

stof commented Jan 19, 2015

This seems weird to me. Messages should be created the Swiftmailer way IMO

@wouterj
Copy link
Member

wouterj commented Jan 31, 2015

@stof can you explain why? Without any knowledge about the subject, I would say that the proposed way is better, as it doesn't advocate anti patterns.

@timglabisch
Copy link
Contributor

i think this is smarter? 👍

@weaverryan
Copy link
Member

If you dig deep enough, it looks like createMessage on Swift_Mailer is the same as the Swift_Message::newInstance() approach (the first uses Swift's odd DIC). The disadvantage is that you don't get auto-complete with this change. Even if your IDE knows that the mailer service returns a Swift_Mailer instance, the createMessage() method (for some reason) simply states @return object.

I see some practical disadvantages, so 👎 for me.

Cheers!

@timglabisch
Copy link
Contributor

the cool thing about createMessage is that you could replace the service and overwrite the method. this doesnt work if you use something like ::newInstance.

@stof
Copy link
Member

stof commented Feb 10, 2015

@wouterj if you don't want to use anti-patterns, don't use Swiftmailer. It uses static service location everywhere anyway (and in very weird ways as it even uses it when calling the parent constructor).

@timglabisch extending the mailer to change the creation of the message looks like the wrong extension point to me. The mailer is here to send messages, not to compose them

@wouterj
Copy link
Member

wouterj commented May 4, 2015

Hmm, I think the decision is to not do this. In that case, #4808 has to be reverted

@wouterj wouterj closed this May 4, 2015
wouterj added a commit that referenced this pull request May 10, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

[Cookbook][Email] revert #4808

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | all
| Fixed tickets | #4884

Commits
-------

b1e8d54 revert #4808
@aitboudad aitboudad deleted the email_message_instantiation branch May 10, 2015 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants