255], ]; } public function beforeSave($insert) { $this->field_template = TransliteratorHelper::transliterate($this->title); return true; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'title' => 'Название', 'field_template' => 'Шаблон поля', ]; } /** * @return \yii\db\ActiveQuery */ public function getDocumentFieldValues() { return $this->hasMany(DocumentFieldValue::className(), ['field_id' => 'id']); } /** * @return \yii\db\ActiveQuery */ public function getTemplateDocumentFields() { return $this->hasMany(TemplateDocumentField::className(), ['field_id' => 'id']); } public static function getIdFieldsTitleList($template_id): array { return self::find()->joinWith('templateDocumentFields') ->where(['template_document_field.template_id' => $template_id]) ->asArray()->all(); } }