php - Yii2 Object of class Closure could not be converted to string -


i've got error object of class closure not converted string on code

'class' => \dosamigos\grid\editablecolumn::classname(),             'attribute' => 'remidi3',             'url' => function($data){return ['update?id=remidi3&dataid'.$data->id];},             'type' => 'text',             'editableoptions' => [                 'mode' => 'inline',             ] 

even i've try change

'url' => function($data){return ['update?id=remidi3&dataid'.$data->id];} 

into

'url' => function($data){return 'update?id=remidi3&dataid'.$data->id;}, 

i need display id in url of editable grid, can me?

according source code , phpdoc, can't specify closure here.

phpdoc says:

/**  * @var string url post  */  public $url; 

usage in source code:

if ($this->url === null) {     throw new invalidconfigexception("'url' property must specified."); }  ...  $url = (array) $this->url; $this->options['data-url'] = url::to($url); 

as can see, it's converted array , processed url::to(), valid types string , array.

i don't think need specify id in url, should taken automatically depending on row working with.


Comments