Newscoop\Services\TemplatesService::getSmarty PHP Метод

getSmarty() публичный Метод

Get current smarty object
public getSmarty ( ) : Smarty
Результат Smarty
    public function getSmarty()
    {
        return $this->smarty;
    }

Usage Example

 /**
  * Sends email notifications
  *
  * @param string                                $code             Email message type
  * @param Newscoop\Entity\User                  $user             User object
  * @param PaywallBundle\Entity\UserSubscription $userSubscription User's subscription
  */
 public function sendNotification($code, array $recipients = array(), array $data = array())
 {
     if ($this->systemPreferences->PaywallEmailNotifyEnabled != '1') {
         return;
     }
     $now = new \DateTime('now');
     $smarty = $this->templatesService->getSmarty();
     $smarty->assign('user', new \MetaUser($data['user']));
     $smarty->assign('userSubscription', new MetaSubscription($data['subscription']));
     try {
         $message = $this->loadProperMessageTemplateBy($code);
     } catch (\Exception $e) {
         throw new \Exception($e->getMessage());
     }
     $recipients = !empty($recipients) ? $recipients : $this->systemPreferences->PaywallMembershipNotifyEmail;
     $this->emailService->send($this->placeholdersService->get('subject'), $message, $recipients, $this->systemPreferences->PaywallMembershipNotifyFromEmail);
 }