L
L
Leopandro2016-01-18 21:45:26
Yii
Leopandro, 2016-01-18 21:45:26

How to correctly pass parameters to the search model?

Here's the code I'm trying to find an element by id_group

$id = ($_GET['id']);
$searchModel = new CharacteristicGroupSearch();
$attributesModel = $searchModel->search(['id_group' => $id]);

Where should I put the parameters? searchModel, by the way generated by gii

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Leopandro, 2016-01-18
@Leopandro

and I entered it manually

$query = CharacteristicGroup::find()->where(['id_group' => $id]);
        $attributesModel = new ActiveDataProvider([
            'query' => $query
        ]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question