コード例 #1
0
 /**
  * @author sepo
  * @abstract
  * @return array all topics related to this newsletter
  */
 function getTopics()
 {
     if (empty($this->_topics) || !is_array($this->_topics)) {
         $this->_topics = array();
         if ($rs = executeQuery("SELECT * FROM topic WHERE newsletter_id='" . $this->getID() . "'")) {
             while ($row = $rs->getrow()) {
                 $topic = new cTopic();
                 $topic->set($row);
                 $this->_topics[] = $topic;
             }
         }
     }
     return $this->_topics;
 }
コード例 #2
0
 function run()
 {
     $retVal = $this->init();
     if ($retVal) {
         $this->message("Running");
         // test isValid
         $c = new cTopic();
         //mydump($c,"Issue");
         $this->assert(!$c->save(), "isValid accepted default values");
         $c->name = "Issue 1";
         $this->assert(!$c->save(), "isValid accepted name only");
         $c->newsletter_id = 15;
         $this->assert($c->save(), "hmmm... should have saved :( ");
         // test if save works fine
         if (empty($c->id) || $c->id == 0) {
             $this->error("what the f.... should have saved and i have no IDea :(");
             $this->success = false;
             //check for email
         } else {
             // remember id and clear object
             $myid = $c->getID();
             $c = 0;
             // reread and check values
             $c = new cTopic($myid);
             $this->assert($c->newsletter_id == 15, 'domain_id is not equal after save');
             $this->assert($c->name == "Issue 1", 'name is not equal after save');
             //delete record
             //$this->assert($c->delete(),"hmmm... should have deleted :( ");
         }
     }
     return $retVal;
 }