English 中文(简体)
如何界定泽德框架中的关系
原标题:How to define relationships in Zend Framework

我有两个简单的表格:<代码>项目和项目

因此,我写道:

class Admin_Model_Projects extends Zend_Db_Table_Abstract
{
    protected $_name =  main_projects ;
    protected $_primary =  mai_id ;
    protected $_sequence = true;
    protected $_dependentTables = array( Admin_Model_SubProjects );
    ....

而且:

class Admin_Model_SubProjects extends Zend_Db_Table_Abstract
{
    protected $_name =  sub_projects ;
    protected $_primary =  sub_id ;
    protected $_sequence = true;
    protected $_referenceMap = array(
         columns  =>  mai_id ,
         refTableClass  =>  Admin_Model_Projects ,
         refColumns  =>  mai_id 
    );
    .....

我很想知道,为什么我拿到<代码>。 表 Admin_Model_Subprojects to table Admin_Model_project 当我打上<代码><?php呼呼应了1美元“现成”;findParentRow(Amin_Model_Projects );?>

最佳回答

Looks like you re missing name of the rule in your referenceMap definition.
It should be

protected $_referenceMap = array(
     Project  => array(
         columns  =>  mai_id ,
         refTableClass  =>  Admin_Model_Projects ,
         refColumns  =>  mai_id 
    )
);
问题回答

您应在所有相关的表格中确定<代码>__参比和_$_dependTables。 当你重新做工作时,将仔细研究。





相关问题
Zend 邮件问题,涉及外国char子+ com子

泽斯德邮局在名称被定为具有外国性质(如“保”)和 com(”)的物品时,就放弃了一种例外(因为邮局(邮局)退回假)。 重新提出以下守则。

PHP Framework: Ebay Like Site

I am going to be builiding a site like ebay - with all the features of ebay. Please note my payment method is limited to paypal. What would be the best PHP framework to use to build this quickly, ...

Link to a specific step in onepage checkout

Is it possible to redirect the browser to nth step in the onepage checkout? If so, how would one go about doing it? I m working on a payment module and have a sort of "cancel" action that i would ...

Tagging with Zend Framework

I m trying to create the same solutions as below, but using a simple MySQL query (instead of the static version used below where the words/tags are implemented in the code). The name of the MySQL ...

dynamicaly adding textboxes to zend_form

I hope that this is a quick question to answer. I am developing a form using Zend_Form, I have a number of Zend_Dojo_Form_Element_Textboxs to add to this form dynamically. These are added from rows ...

热门标签