public function buildNotificationsByTemplateWarningSms(array $smsWarningList, SettingDecimal $settingStudentWarningLimit)
 {
     $smsWarningMessageList = [];
     foreach ($smsWarningList as $notification) {
         $smsMessage = $this->_translator->trans('sms.warning', ['%setting_student_warning_limit%' => $settingStudentWarningLimit->getSettingValue(), '%student%' => $notification->getStudent()->getName()], 'notifications', 'ua');
         $notification->setSmsMessage($smsMessage);
         $smsWarningMessageList[] = $notification;
     }
     return $smsWarningMessageList;
 }
Exemple #2
0
 /**
  * Add settingDecimal
  *
  * @param \AppBundle\Entity\Setting\SettingDecimal $settingDecimal
  * @return Setting
  */
 public function addSettingsDecimal(\AppBundle\Entity\Setting\SettingDecimal $settingDecimal)
 {
     $settingDecimal->setSetting($this);
     $this->settingsDecimal[] = $settingDecimal;
     return $this;
 }
 public function recordNotification(Notification $notification, SettingDecimal $settingSmsExchangeRate)
 {
     if (!$notification->getStudent()) {
         return FALSE;
     }
     if (!$notification->getStudent()->getNfcTag()) {
         return FALSE;
     }
     $item = $this->getNotificationMessageItem();
     $price = bcmul($notification->getPrice(), $settingSmsExchangeRate->getSettingValue(), 2);
     $purchaseService = $this->getPurchaseService();
     $purchaseService->setStudent($notification->getStudent())->setNfcTag($notification->getStudent()->getNfcTag())->setItem($item)->setPrice($price)->setPurchasedAt(new DateTime());
     $this->_manager->persist($purchaseService);
 }