本文整理汇总了PHP中Question::to_sql方法的典型用法代码示例。如果您正苦于以下问题:PHP Question::to_sql方法的具体用法?PHP Question::to_sql怎么用?PHP Question::to_sql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Question
的用法示例。
在下文中一共展示了Question::to_sql方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: to_sql
public function to_sql()
{
$qd = parent::to_sql();
$qd['answers'] = my_json_encode(array_map(function ($a) {
return $a['text'];
}, $this->answers));
$qd['hex_ids'] = implode(',', array_keys($this->answers_by_hex_id));
return $qd;
}
示例2: to_sql
public function to_sql()
{
$qd = parent::to_sql();
$qd['answers'] = my_json_encode($this->raw_answer);
return $qd;
}
示例3: to_sql
public function to_sql()
{
$qd = parent::to_sql();
$get_text = function ($a) {
return $a['text'];
};
$left = array_map($get_text, $this->left_column);
$right = array_map($get_text, $this->right_column);
$qd['answers'] = my_json_encode([$left, $right]);
$qd['hex_ids'] = my_json_encode([array_keys($this->left_column_by_hex_id), array_keys($this->right_column_by_hex_id)]);
return $qd;
}
示例4: to_sql
public function to_sql()
{
$qd = parent::to_sql();
$qd['answers'] = my_json_encode(array_map(function ($a) {
return [$a['text'], (int) $a['fixed'], (int) $a['correct']];
}, $this->answers));
$qd['hex_ids'] = implode(',', array_keys($this->answers_by_hex_id));
$qd['multiple_choice_min_answers'] = $this->min_answers;
$qd['multiple_choice_max_answers'] = $this->max_answers;
return $qd;
}