Пример #1
0
 /**
  * @param $text      string
  * @param $option_id integer
  */
 protected function setRichtextOptions($text, $option_id)
 {
     // удаляем все значения с этим option_id
     $currentRichText = RichTexts::find()->where(['option_id' => $option_id])->one();
     if ($currentRichText) {
         //$currentRichText->updateAttributes(['text' => $text]);
         //var_dump($currentRichText->text);
         $currentRichText->text = $text;
         $currentRichText->save(false);
     } else {
         $richText = new RichTexts();
         $richText->option_id = $option_id;
         $richText->text = $text;
         $richText->save();
     }
 }