email states, writing and reading from cassandra
Writing and reading email states from Cassandra
Refactored the user state emails into delegates\senders which are in charge of talking to all the managers and getting the data for the given user state
Once we get the other emails in line, we'll be able to query cassandra and just
added 4 commits
- 067bcab3...fbbe6842 - 2 commits from branch
minds:master
- 1cc12f34 - Merge remote-tracking branch 'upstream/master' into email_schema
- 30a2f094 - Delegates for sending campaign emails
- 067bcab3...fbbe6842 - 2 commits from branch
unmarked as a Work In Progress
assigned to @brianhatchet
changed the description 2 times within 3 minutes
changed milestone to %sprint: Funny Frog
approved this merge request
1 <?php 2 3 namespace Minds\Core\Email\CampaignLogs; 4 5 use Minds\Traits\MagicAttributes; 6 7 class CampaignLog 8 { 9 use MagicAttributes; 10 11 /** @var int $receiverGuid the user guid who received the email */ 12 public $receiverGuid; - Developer
MagicAttributes entities should have their properties set as
protected
.
1 <?php 2 3 namespace Minds\Core\Email\CampaignLogs; 4 5 use Minds\Traits\MagicAttributes; 6 7 class CampaignLog - Developer
Ideally, to help PHPSpec's Reflection mocks and some IDEs/IntelliSense, you should explicitly declare the getters and setters your entity supports on the PHPDoc of the class and the properties. Example:
/** * @method string getLastName() * @method Brian setLastName(string $lastName) * @method int|string getAge() * @method Brian setAge(int|string $age) */ class Brian { use MagicAttributes; /** @var string */ protected $lastName; /** @var int|string */ protected $age; }
36 * 37 * receiver_guid the user guid 38 * limit 10 39 * 40 * @return CampaignLog[] 41 */ 42 public function getList(array $options = []) 43 { 44 $options = array_merge([ 45 'limit' => 10, 46 'offset' => '', 47 'receiver_guid' => null, 48 ], $options); 49 50 $template = 'SELECT * FROM email_campaign_logs'; 51 $where = []; - Developer
Declaring an array here, but using it as string on L55 and L60
65 66 66 67 return true; 67 68 } 69 70 /** 71 * Returns the short name of the class as the template name. 72 */ 73 public function getEmailCampaignId() 74 { 75 return (new \ReflectionClass($this))->getShortName(); - Developer
I love this, but check with @markeharding if he's OK using Reflection on production.
6 use Minds\Core\Di\Di; 7 use Minds\Core\Suggestions\Manager as SuggestionsManager; 8 use Minds\Core\Onboarding\Manager as OnboardingManager; 9 use Minds\Interfaces\SenderInterface; 10 use Minds\Core\Email\Campaigns\UserRetention\WelcomeComplete; 11 use Minds\Core\Email\Campaigns\UserRetention\WelcomeIncomplete; 12 13 class WelcomeSender implements SenderInterface 14 { 15 /** @var SuggestionsManager */ 16 private $suggestionsManager; 17 /** @var OnboardingManager */ 18 private $onboardingManager; 19 /** @var WelcomeComplete */ 20 private $welcomeComplete; 21 /** @var WelcomeIncomplete */ - Developer
Extra identation space here and below.
15 /** @var SuggestionsManager */ 16 private $suggestionsManager; 17 /** @var OnboardingManager */ 18 private $onboardingManager; 19 /** @var WelcomeComplete */ 20 private $welcomeComplete; 21 /** @var WelcomeIncomplete */ 22 private $welcomeIncomplete; 23 24 25 26 public function __construct( 27 SuggestionsManager $suggestionsManager = null, 28 OnboardingManager $onboardingManager = null, 29 WelcomeComplete $welcomeComplete = null, 30 WelcomeIncomplete $welcomeIncomplete = null) - Developer
Closing paren.