本文整理汇总了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());
}