/** * Returns user's account by user id * * @param int $userId * @return RM_Points_Account */ public function getAccount($userId) { if (isNull($obUser = M('User')->loadUserById($userId))) { throw new RM_Base_Exception_Internal("Unable to load user by id: `{$userId}'"); } return $this->_mapper->loadAccountByUserOrCreate($obUser); }
public function registerAmount($eventName, $value, $description, array $params = array()) { $obPayment = $this->_mapper->storage('payment')->createObject(array('account_id' => $this->id(), 'amount' => $value, 'descr' => $description, 'event' => $eventName, 'amount_date' => M('Date')->dbDate())); foreach ($params as $name => $value) { $obPayment->{$name} = $value; } return $obPayment->save(); }
public function recountStat() { $this->_mapper->recountUserStat(); }
public function execute() { return $this->_mapper->getEvent($this->event)->process($this); }
public function calculateNoPurchaseMark($date = NULL) { return $this->_mapper->getEvent('no-purchase')->init($date); }