pkp-lib
pkp-lib copied to clipboard
Site level mailables can't be accessed with ContextId = null
Describe the bug
A recent change related to the DB foreign keys changed the code that was using 0 as the "placeholder" for the site-related contextId. Now this is set to null.
This affected the Mailables retrieval. All the related functions getByKey, getCollector, etc of the emailTemplate Repository are using int $contextId as a mandatory, not nullable parameter. In case that we may need the site level mailable (like the registration or login processes) the code returns a fatal error, because it tries to pass null in the parameter that this is not allowed.
To Reproduce Steps to reproduce the behavior:
- Try to register a new user with the
[email] => require_validation = Onswitch in the configuration file
What application are you using? OJS, OMP or OPS main branch
PRs
PKP-LIB: #10358
@Vitaliy-1, I have made a PR for that. This one allows a null contextId in the existing emailTemplates repository.
I'm not sure if we want to go in that direction or use a different logic for site-level mailables to avoid mixing them with the existing context-related templates.
However, this seems to work nonetheless.
Merged the PR, thanks!