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

Refactor Email system to builder pattern #436

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

hakito
Copy link
Contributor

@hakito hakito commented Oct 10, 2024

@effgarces Please note that the original PR #426 as well as this was just an incomplete draft. Also #425 in not yet finished in this PR. I just spent a lot of work for this refactoring, so I wanted to share it. But currently I have not time to complete the work.

So here is the rest of the description of the original PR #426:

When I was working on a feature it was quite difficult to implement it because of the current architecture of the email system. This PR holds the current state of my approach, but as it was too risky to break something else I stopped working on it. Maybe it's something for Version 3.0?

The EmailMessage is the base class for all message types and implements an interface. Some of the derived classes have a GetTemplateName method, some don't.

I thought the reason for the architecture is because of a manipulation of the EmailMessage object after it's creation. But it seems that is not the case. All code paths I found create the message and send it to phpmailer without additional modification.

I tried to replace it with a more straighforward builder pattern.

So far I replaced the first view classes with the builder pattern approach. When I came accross GuestAddedEmail wich derives from ReservationEmailMessage things got more complicated. I think this could still be resolved when using a mixture of the builder pattern and the derived class pattern here.

Todos:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Forgot Password changes the language
1 participant