我正在尝试这样做:
$this->PickTicketLineModel->PickTicket->SO->CustomerShipToModel
如果我浏览每一部分,我会得到一个 PickTicketLine 模型,一个 PickTicket 模型,一个 SO 模型。当我到达 CustomerShipToModel 时,我返回 null。由于这应该与数据库中的现有行匹配,我假设关系出了问题。有什么建议么?
Pick Ticket Line Table 关系
'PickTicket' => array(self::BELONGS_TO, 'TblwhPickTicket', 'PickTicketNumber'),
取票表关系
'SO' => array(self::BELONGS_TO, 'TblsoSO', 'SONumber'),
SO 表关系
'CustomerShipToModel' => array(self::BELONGS_TO, 'TblarCustomerShipTo', 'CustomerShipTo'),
客户送货到餐桌关系
'CustomerShipToModel' => array(self::HAS_MANY, 'TblarsoSO', 'CustomerShipTo'),
这就是我首先获得 PickTicketLine 模型的方式:
$this->pickTicketLine = TblwhPickTicketLine::model()->with('PickTicket','PickTicket.SO')->FindByPk(array('PickTicketNumber'=>$pickTicketNumber, 'PickTicketLineNumber'=>$pickTicketLineNumber));