Use the new Mail Template API to create a mail template (using MailTemplate::createTemplate())
New entry in the mail_templates table.
Error: Field 'attachments' doesn't have a default value
Joomla 4 RC5 MySQL 5.7.14
It looks like the API does not take into account the attachments database column.
Since there is no way to add an attachment or a default value in createTemplate(), inserting a template in the database fails.
The database table should have a default value for the 'attachments' column in this case, since attachments are omitted.
Labels |
Added:
?
|
I have updated the bug report to show RC 5 as the version tested.
Thanks @richard67 for the info about the default values in the database :-)
I think it could be fixed here in this function by adding the attachments property to that standard class and set it’s value to an empty string (or json?): https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Mail/MailTemplate.php#L411 .
I’ll have a look tomorrow if that’s the right fix if nobody is faster.
Will work on it today.
Thank you @richard67, I was not able to propose a PR myself (traveling). I appreciate your help.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-08-09 08:57:58 |
Closed_By | ⇒ | richard67 | |
Labels |
Added:
?
Removed: ? |
Closing as having a pull request. Please test #35074 and then mark the test result in the issue tracker here https://issues.joomla.org/tracker/joomla-cms/35074 by using the "Test this" button at the top left corner, selecting the right test result (I hope "success") and submit. Thanks in advance.
@obuisard No, this is wrong. As a column with data type TEXT, it should not have a default value, see PR #27937 and PR #17860 and also https://stackoverflow.com/questions/3466872/why-cant-a-text-column-have-a-default-value-in-mysql for the reasons. Insteasd of this, the API should properly initialize that column value and use it in the insert statement.