本文整理匯總了PHP中Answer::getAnswer方法的典型用法代碼示例。如果您正苦於以下問題:PHP Answer::getAnswer方法的具體用法?PHP Answer::getAnswer怎麽用?PHP Answer::getAnswer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Answer
的用法示例。
在下文中一共展示了Answer::getAnswer方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: flush
/**
*
* @param Answer $answer
* @return int id of the Answer inserted in base. False if it didn't work.
*/
public static function flush($answer)
{
$answerId = $answer->getId();
$answerVar = $answer->getAnswer();
$answerDate = $answer->getAnswerDate();
$likert = $answer->getLikert()->getId();
$user = $answer->getUser()->getId();
$question = $answer->getQuestion()->getId();
if ($answerId > 0) {
$sql = 'UPDATE answer a SET ' . 'a.answer = ?, ' . 'a.answer_date = ?, ' . 'a.LIKERT_id_likert = ?, ' . 'a.USER_id_user = ?, ' . 'a.QUESTION_id_question = ? ' . 'WHERE a.id_answer = ?';
$params = array('ssiiii', &$answerVar, &$answerDate, &$likert, &$user, &$question, &$answerId);
} else {
$sql = 'INSERT INTO answer ' . '(answer, answer_date, LIKERT_id_likert, USER_id_user, QUESTION_id_question) ' . 'VALUES(?, ?, ?, ?, ?)';
$params = array('ssiii', &$answerVar, &$answerDate, &$likert, &$user, &$question);
}
$idInsert = BaseSingleton::insertOrEdit($sql, $params);
if ($idInsert !== false && $answerId > 0) {
$idInsert = $answerId;
}
return $idInsert;
}
示例2: Answer
function test_update()
{
//Arrange
$test_field = "Joe Update";
$test_quest_id = 1;
$test_answer = new Answer($test_field, $test_quest_id);
$test_answer->save();
//Act
$new_answer = "Sam Update";
$test_answer->update($new_answer);
//Assert
$this->assertEquals("Sam Update", $test_answer->getAnswer());
}