With a model called Task, I have the following line of code in my controller:
$criteria = new CDbCriteria(); // build the $criteria $tasks = Task::model()->findAll($criteria);
which works perfectly. However, when I am trying to create a form in my view using:
<?php $form = $this->beginWidget('CActiveForm', array( 'id'=>'addtask', 'enableAjaxValidation'=>true, 'enableClientValidation'=>true, 'focus'=>array($tasks,'name'), )); ?> <?php echo $form->errorSummary($tasks); ?>
it complains that:
get_class() expects parameter 1 to be object, array given
And it refers to the variable $tasks.
Is there anyway to use $criteria in another form of query that the $tasks variable, which is then used in the view, would be an object instead of an array, so that I could use the CActiveForm widget to create the suitable form to update the Task model?