2011-12-28 90 views
1
test: 
    _attributes: { phpName: Test } 
    name: { type: varchar, size: 100 } 
    one_id: { type: INTEGER, foreignTable: second, foreignReference: id} 
    two_id: { type: INTEGER, foreignTable: second, foreignReference: id} 


second: 
    _attributes: { phpName: Second } 
    name:   { type: varchar, size: 100 } 

在Doctrine中,我可以通過$test->getSecond1();$test->getSecond2();得到,但在Propel中這不起作用。我如何從一個關係中獲得另外兩個領域?獲取有一個關係的字段

回答

1

得到正確關聯的對象,當我們有相同的外部表兩名外國文獻,我們需要使用:

$test->getSecondRelatedByOneId() 
$test->getSecondRelatedByTwoId() 

然後我們去Second國外文獻中Test對象,具有:

$test->getOneId() 
$test->getTwoId() 

我現在只使用Propel,所以如果我誤解了,很抱歉。