WIP: epic/Referrals
6/10 discussions resolved
181 182 ->setEntityType('user') 182 183 ->setAction('referral') 183 184 ->push(); 185 186 187 $referral = new Referral(); - Owner
Can we make this a delegate? ie. -> Core/Rewards/Join/Delegates/ReferralDelegate
104 } 105 106 return $success; 107 } 108 109 /** 110 * Update a referral 111 * @param Referral $referral 112 * @return bool 113 */ 114 public function update(Referral $referral) 115 { 116 // incoming $referral will have prospectGuid and joinTimestamp 117 118 // OJMTODO: check - shouldn't need IF EXISTS because referralValidator 119 $template = "UPDATE referrals SET join_timestamp = ? WHERE prospect_guid = ?"; - Owner
should not be necessary as cassandra will upsert
- Resolved by Olivia Madrid
14 15 public function __construct( 16 $repository = null 17 ) 18 { 19 $this->repository = $repository ?: new Repository; 20 } 21 22 /** 23 * Create referral for registered prospect 24 * @param ReferrerGuid $referrerGuid 25 * @return bool 26 */ 27 public function add($referral) 28 { 29 // OJMQ: what happens if the add() fails? - Owner
I would return the value of repository add to solve
- Resolved by Olivia Madrid
- Resolved by Olivia Madrid
- Resolved by Olivia Madrid
36 38 $params['user']->save(); 37 39 $params['user']->subscribe($user->guid); 38 40 } 41 42 // OJMQ: should I put a null value for joinTimestamp here? 43 $referral = new Referral(); 44 $referral->setProspectGuid(Core\Session::getLoggedInUserGuid()) - Owner
Don't assume current session when outside of Controllers.
$params['user']
is passed and a user entity, so we cant take from there
- Resolved by Olivia Madrid
- Resolved by Olivia Madrid