示例#1
0
 protected function initNewsletter()
 {
     $class_name = SwatDBClassMap::get('DeliveranceNewsletter');
     $this->newsletter = new $class_name();
     $this->newsletter->setDatabase($this->app->db);
     if ($this->id !== null) {
         if (!$this->newsletter->load($this->id)) {
             throw new AdminNotFoundException(sprintf('Newsletter with id ‘%s’ not found.', $this->id));
         }
     }
 }
示例#2
0
 protected function initNewsletter()
 {
     $class_name = SwatDBClassMap::get('DeliveranceNewsletter');
     $this->newsletter = new $class_name();
     $this->newsletter->setDatabase($this->app->db);
     if ($this->id !== null && !$this->newsletter->load($this->id)) {
         throw new AdminNotFoundException(sprintf('A newsletter with the id of ‘%s’ does not exist', $this->id));
     }
     // Can't edit a newsletter that has been scheduled. This check will
     // also cover the case where the newsletter has been sent.
     if ($this->newsletter->isScheduled()) {
         $this->relocate();
     }
 }
示例#3
0
 protected function initNewsletter()
 {
     if ($this->id == '') {
         $this->relocate('Newsletter');
     }
     $class_name = SwatDBClassMap::get('DeliveranceNewsletter');
     $this->newsletter = new $class_name();
     $this->newsletter->setDatabase($this->app->db);
     if (!$this->newsletter->load($this->id)) {
         throw new AdminNotFoundException(sprintf('A newsletter with the id of ‘%s’ does not exist', $this->id));
     }
     // Can't cancel a newsletter that has not been scheduled.
     if (!$this->newsletter->isScheduled()) {
         $this->relocate();
     }
     // Can't cancel a newsletter that has been sent.
     if ($this->newsletter->isSent()) {
         $this->relocate();
     }
 }