getExistingEntranceTestSets() as $entranceTestSet) { if (!empty($entranceTestSet['profile_ref_id'])) { $this->insert( self::CONDITION_TYPE_TN, [ 'cget_entrance_test_set_id' => $entranceTestSet['id'], 'profile_reference_type_id' => $entranceTestSet['profile_ref_id'], ] ); } if (!empty($entranceTestSet['education_type_ref_id'])) { $this->insert( self::CONDITION_TYPE_TN, [ 'cget_entrance_test_set_id' => $entranceTestSet['id'], 'dictionary_education_type_id' => $entranceTestSet['education_type_ref_id'], ] ); } } } public function safeDown() { } private function getExistingEntranceTestSets(): array { return (new Query()) ->select([ 'id', 'education_type_ref_id', 'profile_ref_id' ]) ->from(self::ENTRANCE_TEST_SET_TN) ->andWhere(['archive' => false]) ->andWhere([ 'OR', ['IS NOT', 'profile_ref_id', null], ['IS NOT', 'education_type_ref_id', null], ]) ->all(); } }