Tabular Input on nestedsetbehavior
How could it be done?
as example from yii documentation
public function actionBatchUpdate()
{
// retrieve items to be updated in a batch mode
// assuming each item is of model class 'Item'
$items=$this->getItemsToUpdate();
if(isset($_POST['Item']))
{
$valid=true;
foreach($items as $i=>$item)
{
if(isset($_POST['Item'][$i]))
$item->attributes=$_POST['Item'][$i];
$valid=$item->validate() && $valid;
}
if($valid) // all items are valid
// ...do something here
}
// displays the view to collect tabular input
$this->render('batchUpdate',array('items'=>$items));
}
this
$items=$this->getItemsToUpdate();
is placeholder for getting all data that you need for updating
i can change it to
$items=Nestedset::model()->findAll()
am i right?
but when using the nestedsetbehavior, if i want to get the whole tree
im querying
$roots=Category::model()->roots()->findAll();
then
Category::model()->findAll(array('condition'=>'root=$roots','order'=>'lft');
How to make it become like this
$roots=Category::model()->roots()->findAll();
I’m just stuck, or could you give me some logic how to do this?
thanks