public function reOrderQuestion($sectionName, array $questionOrder) { if ($questionOrder === null || !is_array($questionOrder) || count($questionOrder) === 0) { return false; } $section = null; if ($sectionName !== null) { $section = $this->sectionDao->findBySectionName($sectionName); if ($section === null) { return false; } $section = $section->name; } $questionNameList = array_keys($questionOrder); $questions = $this->questionDao->findQuestionsByQuestionNameList($questionNameList); if (count($questionOrder) === 0) { return false; } foreach ($questions as $key => $question) { if (isset($questionOrder[$question->name])) { $questions[$key]->sortOrder = $questionOrder[$question->name]; $questions[$key]->sectionName = $section; } } $result = $this->questionDao->batchReplace($questions); return $result; }
/** * @param array $objects */ public function batchReplace($objects) { $this->emailVerifiedDao->batchReplace($objects); }