Problem/Motivation
Those classes use custom construction and configuration code, using class names. That's a typical pattern for plugins. Or services.
Additionally, the naming is strange, I don't remember why we went with this name.
Proposed resolution
What it essentially represents is a mail spool entry, and we renamed the methods there to *Mail(), so naming these Mail would make more sense. We could also rename SpoolList to MailList.
We might also need a new concept of how we configure/construct them. I'm not sure the concept of entity type specific implementation still makes sense in 8.x, and there also isn't really an option to use something else. For that to actually make sense, we'd need a new column in the database that indicates the plugin that should be used?
So... maybe we should just drop built-in pluggability there completely? We still have a test implementation that we're passing in directly somewhere, but that should still work.
Which leaves us with caching. Where just having a service would be nice, but then we lose the current ability to configure it in the UI. Question is, do we need that? We could just document how to add a site specific service override and provide two implementations?
Thoughts?
Remaining tasks
User interface changes
API changes
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | simplenews-source-mail-rename-2481151-6-interdiff.txt | 343 bytes | berdir |
| #6 | simplenews-source-mail-rename-2481151-6.patch | 41.77 KB | berdir |
| #4 | simplenews-source-mail-rename-2481151-4.patch | 41.8 KB | berdir |
Comments
Comment #1
berdirComment #2
miro_dietikerService: I think caching is is not a global topic. An active site might have some newsletter that is similar for all recipients except token replacement. And then a second mail that is highly personalised.
Does your proposal cover for this?
Rest yeah, UI is not soo needed and slim code is possibly a much better fit.
But also here i'm not sure about how things work if multiple cases coexist on the same system.
Comment #3
berdirNo, if we just have a service, then that would be global. It is currently global too. If we want to keep that possibility then we need plugins.
Comment #4
berdirGot started here. Renamed everything to Mail*
Source/Mail cache hook/discovery/configurability is gone, it is a service now.
The answer to your concern is services and dependency injection. the mail cache is now injected into the mail class, if you want to use a different one, just create your own mail objects and pass it in. We do it in tests, and it is also possible to override the relevant services and use a different object. Might require to copy & paste a bunch of code right now but we can also improve that.
Comment #6
berdir...
Comment #8
miro_dietikerPromoting to critical since it significantly affects APIs.
Comment #9
berdirThis patch is big enough, test fails were just the usual random fails. Committed. We'll need separate issues to rely more/only on default render caching.