Zend_Form :: populate () hatası

0 Cevap php

Ive burada bir sorun çeşit var. Ben bu işlevi çalıştığınızda, bu hatayı döndürür:

Catchable fatal error: Argument 1 passed to Zend_Form::populate() must be an array, object given, called in [..]

Ben 1. argüman değerlerini bulmak için print_r () kullanıldığında, çıkış bu oldu:

Zend_Db_Table_Row Object ( [_data:protected] => Array ( [id] => 4 [title] => sd [name] => KG [picture] => http://xx/images/mny4r64mqb.png [show] => 1 [body] =>KB
) [..]

So I know, that the object I input is an array. What could be causing this problem? The model

public function getUser($id) 
    {
        $id = (int)$id;
        $row = $this->fetchRow('id = ' . $id);
        $row->toArray();
        if (!$row) {
            throw new Exception("Could not find row $id");
        }
        return $row;    
    }

Kontrolör:

 $albums = new Admin_Model_Users ();
                    //print_r($albums->getUser($id));
                    $form->populate ( $albums->getUser ( $id ) );

0 Cevap