当前位置: 首页>>代码示例>>PHP>>正文


PHP Question::getAll方法代码示例

本文整理汇总了PHP中Question::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Question::getAll方法的具体用法?PHP Question::getAll怎么用?PHP Question::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Question的用法示例。


在下文中一共展示了Question::getAll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: findById

 static function findById($search_id)
 {
     $found_question = null;
     $returned_questions = Question::getAll();
     foreach ($returned_questions as $question) {
         $id = $question->getId();
         if ($search_id == $id) {
             $found_question = $question;
         }
     }
     return $found_question;
 }
开发者ID:umamiMike,项目名称:promptr,代码行数:12,代码来源:Question.php

示例2: manage

 public static function manage()
 {
     self::ensureAdmin();
     // Handle creation of vanilla questions.
     $createVanillaData = self::createVanilla();
     // Handle deletion of questions.
     self::delete();
     // Handle editing of questions.
     self::edit();
     // Load all questions.
     $questions = Question::getAll();
     $typeMap = mapDataArrayByField($questions, function (Question $each) {
         return $each->getVanilla();
     }, [true => 'vanilla', false => 'custom']);
     $viewData = ['vanilla' => [], 'custom' => []];
     foreach ($typeMap['vanilla'] as $vanilla) {
         $viewData['vanilla'][] = $vanilla->getData();
     }
     foreach ($typeMap['custom'] as $custom) {
         $viewData['custom'][] = $custom->getData();
     }
     self::render('admin/questions', array_merge($viewData, $createVanillaData));
 }
开发者ID:davidliuliuliu,项目名称:sublite,代码行数:23,代码来源:AdminController.php

示例3: test_delete

 function test_delete()
 {
     //Arrange
     $test_field = "What is their name?";
     $test_description = "What you want to call your character.";
     $test_question = new Question($test_field, $test_description);
     $test_question->save();
     $test_field2 = "What is their profession?";
     $test_description2 = "What you want your character to do.";
     $test_question2 = new Question($test_field2, $test_description2);
     $test_question2->save();
     //Act
     $test_question->delete();
     $result = Question::getAll();
     //Assert
     $this->assertEquals($test_question2, $result[0]);
 }
开发者ID:umamiMike,项目名称:promptr,代码行数:17,代码来源:QuestionTest.php

示例4: test_getQuestions

 function test_getQuestions()
 {
     $name = "mikes 5 top interview questions";
     $test_promptr = new Promptr($name);
     $test_promptr->save();
     $question = "What is your biggest weakness punk?";
     $description = "This question goes straight for the jugular";
     $test_question = new Question($question, $description);
     $test_question->save();
     $test_promptr->addQuestion($test_question);
     $question2 = "Who are you really?";
     $description2 = "I mean really really";
     $test_question2 = new Question($question2, $description2);
     $test_question2->save();
     $test_promptr->addQuestion($test_question2);
     $result = Question::getAll();
     $end_question = new Question($question, $description, $result[0]->getId());
     $end_question2 = new Question($question2, $description2, $result[1]->getId());
     $this->assertEquals([$end_question, $end_question2], $result);
 }
开发者ID:umamiMike,项目名称:promptr,代码行数:20,代码来源:PromptrTest.php


注:本文中的Question::getAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。