protected function insertWords()
    {
        try {
            $vocabulary = [];
            $allWords = $this->prepareWords();
            $this->addNewWords($allWords);
            $query = (new Query())->from(Vocabulary::tableName())->where(['word' => $allWords]);
            foreach ($query->each() as $vocabularyNew) {
                $vocabulary[] = [$vocabularyNew['id'], $this->id];
            }
            if (!empty($vocabulary)) {
                if (!Podium::getInstance()->db->createCommand()->batchInsert(
                        '{{%podium_vocabulary_junction}}', ['word_id', 'post_id'], $vocabulary
                    )->execute()) {
                    throw new Exception('Words connections saving error!');
                }
            }
        } catch (Exception $e) {
            Log::error($e->getMessage(), null, __METHOD__);
            throw $e;
        }
    }
protected function insertWords()
    {
        try {
            $vocabulary = [];
            $allWords = $this->prepareWords();
            $this->addNewWords($allWords);
            $query = (new Query())->from(Vocabulary::tableName())->where(['word' => $allWords]);
            foreach ($query->each() as $vocabularyNew) {
                $vocabulary[] = [$vocabularyNew['id'], $this->id];
            }
            if (!empty($vocabulary)) {
                if (!Podium::getInstance()->db->createCommand()->batchInsert(
                        '{{%podium_vocabulary_junction}}', ['word_id', 'post_id'], $vocabulary
                    )->execute()) {
                    throw new Exception('Words connections saving error!');
                }
            }
        } catch (Exception $e) {
            Log::error($e->getMessage(), null, __METHOD__);
            throw $e;
        }
    }
protected function insertWords ( ) { try { $ vocabulary = [ ] ; $ allWords = $ this -> prepareWords ( ) ; $ this -> addNewWords ( $ allWords ) ; $ query = ( new Query ( ) ) -> from ( Vocabulary :: tableName ( ) ) -> where ( [ 'word' => $ allWords ] ) ; foreach ( $ query -> each ( ) as $ vocabularyNew ) { $ vocabulary [ ] = [ $ vocabularyNew [ 'id' ] , $ this -> id ] ; } if ( ! empty ( $ vocabulary ) ) { if ( ! Podium :: getInstance ( ) -> db -> createCommand ( ) -> batchInsert ( '{{%podium_vocabulary_junction}}' , [ 'word_id' , 'post_id' ] , $ vocabulary ) -> execute ( ) ) { throw new Exception ( 'Words connections saving error!' ) ; } } } catch ( Exception $ e ) { Log :: error ( $ e -> getMessage ( ) , null , __METHOD__ ) ; throw $ e ; } }
Inserts tag words.
@throws Exception
Inserts tag words .