Zend framework ZendFramework:无法将类的对象转换为字符串

Zend framework ZendFramework:无法将类的对象转换为字符串,zend-framework,zend-form,Zend Framework,Zend Form,嘿,伙计们,我有一个带有一个输入框的表单,当我提交表单时,我得到以下错误: 可捕获的致命错误:在第228行调用堆栈:0.0002 657600 1上的/Users/Ric/Sites/MN/library/Zend/Db/Statement/Pdo.php中,类应用程序对象_Model_DbTable_注释无法转换为字符串。{main}()/Users/Ric/Sites/MN/public/index.php:0.0323 6224344 2。Zend_Application->run()/U

嘿,伙计们,我有一个带有一个输入框的表单,当我提交表单时,我得到以下错误:

可捕获的致命错误:在第228行调用堆栈:0.0002 657600 1上的/Users/Ric/Sites/MN/library/Zend/Db/Statement/Pdo.php中,类应用程序对象_Model_DbTable_注释无法转换为字符串。{main}()/Users/Ric/Sites/MN/public/index.php:0.0323 6224344 2。Zend_Application->run()/Users/Ric/Sites/MN/public/index.php:28 0.0323 6224344 3。Zend_Application_Bootstrap_Bootstrap->run()/Users/Ric/Sites/MN/library/Zend/Application.php:366 0.0324 6224480 4。Zend_Controller_Front->dispatch()/Users/Ric/Sites/MN/library/Zend/Application/Bootstrap/Bootstrap.php:97 0.0420 7942648 5。Zend_Controller_Dispatcher_Standard->dispatch()/Users/Ric/Sites/MN/library/Zend/Controller/Front.php:954 0.0474 8519528 6。Zend_Controller_Action->dispatch()/Users/Ric/Sites/MN/library/Zend/Controller/Dispatcher/Standard.php:295 0.0475 8528200 7。ClubDescriptionController->indexAction()/Users/Ric/Sites/MN/library/Zend/Controller/Action.php:516 0.0760 12357968。Application\u Model\u DbTable\u Comments->addComment()/Users/Ric/Sites/MN/Application/controllers/ClubDescriptionController.php:33 0.0760 12358408 9。Zend_Db_Table_Abstract->insert()/Users/Ric/Sites/MN/application/models/DbTable/Comments.php:25 0.0790 12371776 10。Zend_Db_Adapter_Abstract->insert()/Users/Ric/Sites/MN/library/Zend/Db/Table/Abstract.php:1075 0.0791 12373808 11。Zend_Db_Adapter_Pdo_Abstract->query()/Users/Ric/Sites/MN/library/Zend/Db/Adapter/Abstract.php:575 0.0791 12373888 12。Zend_Db_Adapter_Abstract->query()/Users/Ric/Sites/MN/library/Zend/Db/Adapter/Pdo/Abstract.php:238 0.0793 12379024 13。Zend_Db_语句->execute()/Users/Ric/Sites/MN/library/Zend/Db/Adapter/Abstract.php:479 0.0793 12379024 14。Zend_Db_Statement_Pdo->_execute()/Users/Ric/Sites/MN/library/Zend/Db/Statement.php:300 0.0793 12379104 15。PDOStatement->execute()/Users/Ric/Sites/MN/library/Zend/Db/Statement/Pdo.php:228

表格如下:

<?php

class Application_Form_Comment extends Zend_Form
{

public function init()
{
    $this->setName('comment');
    $id = new Zend_Form_Element_Hidden('id');
  $id->addFilter('Int');
        $comment = new Zend_Form_Element_Text('comment');
        $comment->setLabel('Comment:')
            ->setRequired(true)
            ->addFilter('StripTags')
            ->addFilter('StringTrim')
            ->addValidator('NotEmpty');
    $submit = new Zend_Form_Element_Submit('submit');
    $submit->setAttrib('id', 'submitbutton');
    $this->addElements(array($id, $comment, $submit));
        }
    }
模型:

类应用程序\u模型\u DbTable\u注释扩展了Zend\u Db\u Table\u抽象 {

}

观点:

<div id="comments">
    <?php echo $this->form; ?>
</div>

谢谢

里克

你的问题就在这里

$comment = $form->getValue('comment');
$comment = new Application_Model_DbTable_Comments();
$comment->addComment($comment);
换成

$comment = new Application_Model_DbTable_Comments();
$comment->addComment($form->getValue('comment'));

如果我将comment函数放在索引操作的单独函数中,如何从视图调用它。。索引操作中有更多代码,这两个代码相互冲突。。
$comment = $form->getValue('comment');
$comment = new Application_Model_DbTable_Comments();
$comment->addComment($comment);
$comment = new Application_Model_DbTable_Comments();
$comment->addComment($form->getValue('comment'));