version=4 is not passed to Mailing.create on APIv4 so MailingJob gets scheduled
Overview
I'd like to create a single Mailing entity through APIv4 without scheduling a MailingJob and calculating recipients.
Reproduction steps
- Call Mailing.create through API Explorer or
cv
- Notice that a MailingJob is created
Current behaviour
According to https://github.com/civicrm/civicrm-core/blob/94b9b95547d3f8292740c059f77f83cc45e57b57/CRM/Mailing/BAO/Mailing.php#L1622-L1629 this shouldn't happen by default, but it does: $params['version']
is empty and self::doSubmitActions()
is called.
Expected behaviour
$params['version']
is populated so CRM_Mailing_BAO_Mailing::doSubmitActions()
doesn't fire.
Comments
This is similar to https://github.com/civicrm/civicrm-core/blob/94b9b95547d3f8292740c059f77f83cc45e57b57/CRM/Member/BAO/Membership.php#L334-L343. In that case Civi\Api4\Service\Spec\Provider\MembershipCreationSpecProvider
injects version
parameter into the API call, but for Mailing such spec provider doesn't exists.
I can do some work with this, I'm just not sure if that spec provider is missing by design or not...
Also I can pass in version=4
explicitly or use _skip_evil_bao_auto_schedule_
and _skip_evil_bao_auto_recipients_
to prevent submit actions to happen.