Closed psfpro closed 9 years ago
What do you mean by that? Standard attributes list should be unique regardless of extendStandardAttributes
option.
When I make a custom field, I have no unique attributes. For exemple attribute: 'name' => 'user_id'.
[ 'name' => 'user_id', 'valueReplacement' => function ($model) { /* @var $model Device */ return $model->user->name; }, 'label' => 'Name', ], [ 'name' => 'user_id', 'valueReplacement' => function ($model) { /* @var $model Device */ return $model->user->surname; }, 'label' => 'Surname', ],
What do you think about this? What other configuration options?
To be honest, I was in hurry when writing exporter. I didn't even update the README with basic example of usage.
The main problem is that used StandardModel in export is from import (see #6). It's better to use separate extended StandardModel for export, it will solve this problem.
Your solution will also touch import.
If you need this urgently, you can use fork.
I will try to fix it as soon as possible.
Fixed in b84f2eb. Use this instead:
[
'name' => 'user_name',
'label' => 'Name',
'valueReplacement' => function ($model) {
/* @var $model Device */
return $model->user->name;
},
],
[
'name' => 'user_surname',
'label' => 'Surname',
'valueReplacement' => function ($model) {
/* @var $model Device */
return $model->user->surname;
},
],
Will update README soon.
custom labels for columns For exemples: