Пример #1
0
 public function add($optionText, $questionId)
 {
     if (empty($optionText)) {
         echo 'Empty Option';
         return;
     }
     try {
         $entity = $this->connect()->newEntity();
         $entity->OptionText = $optionText;
         $entity->QuestionId = $questionId;
         if ($this->connect()->save($entity)) {
             $optionDto = new DownloadDto\OptionsDto($entity->OptionId, $optionText, $questionId);
             $syncController = new Controller\SyncController();
             $syncController->optionEntry(json_encode($optionDto), INSERT);
             return $entity->optionId;
         }
         return FAIL;
     } catch (Exception $ex) {
         return FAIL;
     }
 }