public function _assignToDefault($categoryId) { $defaultCategory = FaqCategory::getDefault($this->getAccountId()); $condition = ['isDeleted' => false, 'faqCategoryId' => $categoryId]; $results = Faq::find()->where($condition)->all(); foreach ($results as $result) { $result['faqCategoryId'] = $defaultCategory->_id . ''; $result->save(); } }
public function getQuestions() { $condition = ['isDeleted' => false, 'accountId' => $this->accountId, 'faqCategoryId' => $this->_id . '']; return Faq::find()->where($condition)->orderBy(['createdAt' => SORT_DESC])->all(); }