コード例 #1
0
 public function load(ObjectManager $manager)
 {
     $information = new Information();
     $information->setTitle("About Me");
     $information->setBody("<p>Rofilde Hasudungan research are in DNA based Computer</p>");
     $information->setPublished(true);
     $manager->persist($information);
     $news = new news();
     $news->setTitle("About Me");
     $news->setBody("<p>Rofilde Hasudungan research are in DNA based Computer</p>");
     $news->setPublished(true);
     $manager->persist($news);
     $manager->flush();
 }
コード例 #2
0
ファイル: class.news.php プロジェクト: ruslans/testeducon
 public function getAllAsObject($restriction = '')
 {
     $sql = "SELECT *\n\t\t\t      FROM news \n\t\t\t     WHERE 1=1 ";
     $sql .= $restriction . ";";
     try {
         $result = mysql_query($sql);
         if (!$result) {
             throw new MysqlException();
         }
         $newsn = array();
         while ($row = mysql_fetch_assoc($result)) {
             $n = new news();
             $n->setId($row['news_id']);
             $n->setDatum($row['datum']);
             $n->setTitle($row['title']);
             $n->setTextfield($row['textfield']);
             $newsn[$n->getId()] = $n;
         }
     } catch (MysqlException $e) {
         Html::showAll($e);
     }
     return $newsn;
 }