嗨我在每个模块上都有两个模块我有模型和表类,我想在每个模块中引用两个表一类。
这就是我所拥有的:
这是发票模块。
class Invoice_Resource_InvoiceByProgress extends SA_Model_Resource_Db_Table_Abstract
implements Invoice_Resource_InvoiceByProgress_Interface
{
protected $_name = 'invoice_by_progress';
protected $_primary = array('invoice_by_progressId');
protected $_rowClass = 'Invoice_Resource_InvoiceByProgress_Item';
protected $_referenceMap = array(
'Project2client' => array(
'columns' => 'project2clientId',
'refTableClass' => 'Siteanalysis_Resource_Project2client',
'refColumns' => 'project2clientId',
'onDelete' => self::CASCADE
),
);
这个是在Siteanalysis Module中。
class Siteanalysis_Resource_Project2client extends SA_Model_Resource_Db_Table_Abstract
implements Siteanalysis_Resource_Project2client_Interface
{
protected $_name = 'project2client';
protected $_primary = 'project2clientId';
protected $_rowClass = 'Siteanalysis_Resource_Project2client_Item';
protected $_dependentTables = array('Invoice_Resource_InvoiceByProgress');
protected $_referenceMap = array(
'Project' => array(
'columns' => 'projectId',
'refTableClass' => 'Siteanalysis_Resource_Project',
'refColumns' => 'projectId',
'onDelete' => self::CASCADE
),);
我的问题是如何让$ _referenceMap工作?
提前致谢。
答案 0 :(得分:0)
问题在于
protected $ _dependentTables = array('Invoice_Resource_InvoiceByProgress');
必须是
protected $ _dependentTables = array('Invoice_Resource_Invoicebyprogress');
而不是类名称文件名。