Top "Yii2-model" questions

Use this tag if your question relates to the Yii2-model-class or one of its descendants.

model->save() Not Working In Yii2

Previously, I was not using $model->save() function for inserting or updating any data. I was simply using createCommand() …

php yii2 yii2-basic-app yii2-model
Yii2: How to set default attribute values in ActiveRecord?

This may seem like a trivial question, however all of the obvious solutions that I can think of have their …

activerecord yii2 yii2-model yii2-validation
Yii2 dropdown multiple selected values

I used Yii2 multiple selection dropdown , it is working fine at create but not showing me selected values on update! …

yii2 yii2-model
Yii2, Custom validation message with attribute names

In Login form, I need to have glyphicon-remove icon at the end of every validation message with the corresponding field …

php yii2 yii2-model yii2-validation
Trying to get property of non-object in yii2

I want access to hasMany relation but i get error with this content PHP Notice – yii\base\ErrorException Trying to …

php yii2 yii2-model
Yii2 Select only few columns from related model

In controller i have: public function actionGetItems() { $model = new \app\models\WarehouseItems; $items = $model->find()->with(['user'])…

yii2 yii2-model
How to join two tables and get values in Yii2 gridview

I'm using Yii2 gridview widget to display the data. I'm using two tables named as message and message_trigger. In …

gridview yii2 yii2-model
Yii2 multiple models in one form

How to use multiple models in one form in Yii2? My case: In my create action I can save into …

php yii2 yii2-model
How to create a directory inside a directory in yii2 and upload file into that directory

I have a form <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> <?php echo $form-&…

yii2 yii2-advanced-app yii2-basic-app yii2-model yii2-validation
How to search with an array in Yii2 search model

public function actionIndex() { $searchModel = new SubjectSearch(); $searchModel->search()->query->andFilterWhere(['in','subjectID',[1,2,3]]); $dataProvider = $searchModel->search(…

php yii2 many-to-many yii2-model