Answer the question
In order to leave comments, you need to log in
How to make ActiveRecord mongodb return a prayer, but an array?
I am using Yii mongodb extension, getting data and drawing in grid. By analogy, as MySQL wanted to customize the value of a column, it turns out that by default, not a model is passed to an anonymous function, but just an array.
[
'attribute' => 'type_id',
'label' => 'Список',
'value' => function($model) {
return print_r($model, true); // здесь нельзя работать как с моделью вызывая из неё функции
}
],
use yii\data\ActiveDataProvider;
use yii\mongodb\Query;
$query = new Query();
$query->from('tariffs')->where(['user_id' => $user->id]);
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSize' => 10,
]
]);
Answer the question
In order to leave comments, you need to log in
It turns out that by default, not a model is passed to an anonymous function, but just an array.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question