예제 #1
0
 public function update($data)
 {
     $result = false;
     $pdo = DbUtil::connect();
     $dao = new M12QuestionDao($pdo);
     // create new category object
     $obj = new M12QuestionBO();
     // get id from request
     if (property_exists($data, 'id')) {
         $obj->setM12Questionid($data->id);
     }
     // get the persistance obj from db
     $obj = $dao->getById($obj);
     $obj->import($data);
     $result = $dao->update($obj);
     DbUtil::disconnect();
     return $result;
 }
예제 #2
0
 public function getById(M12QuestionBO $obj)
 {
     $stmt = $this->db->prepare(self::$selectByIdSQL);
     $id = intval($obj->getM12questionid());
     $stmt->execute(array($id));
     $row = $stmt->fetch(PDO::FETCH_ASSOC);
     if ($row != null) {
         $obj = new M12QuestionBO();
         $obj->setM12questionid($row['M12QUESTIONID']);
         $obj->setDescription($row['DESCRIPTION']);
         $obj->setCreatedon($row['CREATEDON']);
         $obj->setCreatedby($row['CREATEDBY']);
         $obj->setModifiedon($row['MODIFIEDON']);
         $obj->setModifiedby($row['MODIFIEDBY']);
         $obj->setActive($row['ACTIVE']);
         $obj->setM11statusid($row['M11STATUSID']);
     }
     return $obj;
 }