public function actionEditPart($id = '') { $model = $this->loadModel(ThemeParts::className(), $id, true); if ($model->isNewRecord === true) { $model->loadDefaultValues(); } if ($model->load(Yii::$app->request->post()) && $model->validate()) { if ($model->save()) { return $this->redirectUser($model->id, true, 'index', 'edit-part'); } } return $this->render('edit-part', ['model' => $model]); }
/** * Relation to ThemeParts that we can apply to * @return \yii\db\ActiveQuery */ public function getApplicableParts() { return $this->hasMany(ThemeParts::className(), ['id' => 'part_id'])->via('applying'); }
/** * Relation to ThemeParts that we can apply to * @return \yii\db\ActiveQuery */ public function getPart() { return $this->hasOne(ThemeParts::className(), ['id' => 'part_id']); }
/** * @param array $attributesRow * @return string[] Array of cache tags */ public static function getCacheTags($attributesRow) { $tags = explode("\n", $attributesRow['cache_tags']); $tags[] = ActiveRecordHelper::getObjectTag(ThemeParts::className(), $attributesRow['id']); $tags[] = ActiveRecordHelper::getCommonTag(ThemeActiveWidgets::className()); return $tags; }