-
-
Notifications
You must be signed in to change notification settings - Fork 814
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
dev/core#2486 Add v4 Mailing api (+ MailingJob) #22624
Conversation
(Standard links)
|
@eileenmcnaughton there is a related test failure:
|
thanks @monishdeb - could be worse :-) |
* @since 5.47 | ||
* @package Civi\Api4 | ||
*/ | ||
class MailingJob extends Generic\DAOEntity { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make MailingJob
readonly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eileenmcnaughton the @readonly
annotation isn't right. Instead you have to use the ReadOnlyEntity
trait.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@colemanw thanks - fixed
78f6421
to
37bb3eb
Compare
@colemanw I'm not sure why MailingJob doesn't create the 'Mailing' it requires in testConformance. Note the only reason we need MailingJob is that once we want to start to get other details - eg. bounces we need to join through MailingJob to MailingEventQueue to MailingEventBounce |
4714a0e
to
7e5ada4
Compare
@eileenmcnaughton I fixed the conformance test which triggered a new test run. But the previous run showed other problems: https://test.civicrm.org/job/CiviCRM-Core-PR/47154/#showFailuresLink |
5e4086a
to
ba41f67
Compare
@eileenmcnaughton looks like just one test error left... |
ba41f67
to
1b9b056
Compare
public static function createAndRun($mailing) { | ||
$validator = new \Civi\FlexMailer\Validator(); | ||
return $validator->run(array( | ||
public static function createAndRun(array $params): array { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@colemanw @eileenmcnaughton - The failures in ValidatorTest
are complaining because the signature changed (DAO => array).
It should be straight-forward to update the test:
diff --git a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ValidatorTest.php b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ValidatorTest.php
index 35541e5e67..642d4527b2 100644
--- a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ValidatorTest.php
+++ b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ValidatorTest.php
@@ -86,9 +86,7 @@ class ValidatorTest extends \CiviUnitTestCase {
* @dataProvider getExamples
*/
public function testExamples($mailingData, $expectedErrors): void {
- $mailing = new \CRM_Mailing_DAO_Mailing();
- $mailing->copyValues($mailingData);
- $actualErrors = Validator::createAndRun($mailing);
+ $actualErrors = Validator::createAndRun($mailingData);
$this->assertEquals(
array_keys($actualErrors),
array_keys($expectedErrors)
Grepped universe
for createAndRun
-- I don't see anything outside of civicrm-core
that uses it.
Overview
dev/core#2486 Add v4 Mailing api (+ MailingJob)
Before
No v4 api for Mailing
After
Tada
Technical Details
@colemanw @seamuslee001 @totten this is a starting point but there are some bizarre things regarding the Mailing create function
_evil_bao_validator_
- this is where either flexmailer or the legacy method validate_skip_evil_bao_auto_recipients_
..... - UPDATE agreedsetPopulateReceipients
- default to FALSEI'm not quite sure how best to deal with 2 & 3. Note we did talk about moving the legacy Mailing stuff to an extension - which probably would have made this easier at least WRT 2
Comments
https://lab.civicrm.org/dev/core/-/issues/2486