public function getAttributesByRole() { $model = AuthItem::find()->select('name')->where(['name' => $this->getRolesByUser()])->with('visibleAttributes', 'editableAttributes')->one(); if ($model->visibleAttributes !== null || $model->editableAttributes !== null) { return $model; } else { throw new NotFoundHttpException('The project not have any roles configured.'); } }