-
-
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
932ea7d
dev/core#2486 Add v4 Mailing api (+ MailingJob)
eileenmcnaughton 7e0fcd9
Move validator out of BAO into v3 api
eileenmcnaughton cbbddb8
Block crud for v4 api
eileenmcnaughton 1b9b056
APIv4 - Create necessary fk entities in conformance test
colemanw 4eefbb3
FlexMailer - Update test
colemanw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
/* | ||
+--------------------------------------------------------------------+ | ||
| Copyright CiviCRM LLC. All rights reserved. | | ||
| | | ||
| This work is published under the GNU AGPLv3 license with some | | ||
| permitted exceptions and without any warranty. For full license | | ||
| and copyright information, see https://civicrm.org/licensing | | ||
+--------------------------------------------------------------------+ | ||
*/ | ||
namespace Civi\Api4; | ||
|
||
/** | ||
* Mailing. | ||
* | ||
* Mailing entities store the contents and settings for bulk mails. | ||
* | ||
* @searchable secondary | ||
* @see https://docs.civicrm.org/user/en/latest/email/what-is-civimail/ | ||
* @since 5.47 | ||
* @package Civi\Api4 | ||
*/ | ||
class Mailing extends Generic\DAOEntity { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
/* | ||
+--------------------------------------------------------------------+ | ||
| Copyright CiviCRM LLC. All rights reserved. | | ||
| | | ||
| This work is published under the GNU AGPLv3 license with some | | ||
| permitted exceptions and without any warranty. For full license | | ||
| and copyright information, see https://civicrm.org/licensing | | ||
+--------------------------------------------------------------------+ | ||
*/ | ||
namespace Civi\Api4; | ||
|
||
use Civi\Api4\Generic\Traits\ReadOnlyEntity; | ||
|
||
/** | ||
* Mailing job. | ||
* | ||
* Mailing job tracks the batching of CiviMails. | ||
* | ||
* @searchable none | ||
* | ||
* @see https://docs.civicrm.org/user/en/latest/email/what-is-civimail/ | ||
* @since 5.47 | ||
* @package Civi\Api4 | ||
*/ | ||
class MailingJob extends Generic\DAOEntity { | ||
use ReadOnlyEntity; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,14 +25,20 @@ class Validator { | |
const EVENT_CHECK_SENDABLE = 'civi.flexmailer.checkSendable'; | ||
|
||
/** | ||
* @param \CRM_Mailing_DAO_Mailing $mailing | ||
* @param array $params | ||
* The mailing which may or may not be sendable. | ||
* @return array | ||
* List of error messages. | ||
*/ | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. @colemanw @eileenmcnaughton - The failures in 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 |
||
$mailing = new \CRM_Mailing_BAO_Mailing(); | ||
$mailing->id = $params['id'] ?? NULL; | ||
if ($mailing->id) { | ||
$mailing->find(TRUE); | ||
} | ||
$mailing->copyValues($params); | ||
|
||
return (new Validator())->run(array( | ||
'mailing' => $mailing, | ||
'attachments' => \CRM_Core_BAO_File::getEntityFile('civicrm_mailing', $mailing->id), | ||
)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theReadOnlyEntity
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.
@eileenmcnaughton ^
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