In a cotroller I have an array $fruits. When I dump it it looks like this:
$fruits:
array
(
0 => array
(
0 => 'banana'
1 => 'cherry'
2 => 'apple'
)
1 => array
(
0 => 'yellow'
1 => 'red'
2 => 'green'
)
)
I call my views with
$this->render('fruits_view_1', array(
'fruits' => $fruits
$this->render('fruits_view_2', array(
'fruits' => $fruits
View 1 for only displaying works fine:
<?= CHtml::encode($table[0][1]) ?>
View 2 for editing does not work:
<?php
$form = $this->beginWidget('CActiveForm', array('id' => 'fruits-form'));
?php
<?= $form->textArea($fruits, $fruits[0][1], array('rows' => 3, 'cols' => 20)); ?>
I get the error "Array to string conversion"
$fruits is not a model it’s an array.
What’s the problem? And an idea for a workaround?