PropelのforeignKeyは、主キー制約しか想定していない
ようだ。
主キー以外にunique制約を加えたカラムをforeignKeyとして指定しても、こんな感じのコードが生成され、内部でretrieveByPKメソッドが使用されるので、外部キーで関連付けたオブジェクトを正しく取得できない。
public function getSectionRelatedByParentId($con = null) { if ($this->aSectionRelatedByParentId === null && ($this->parent_id !== null)) { include_once 'lib/model/om/BasesfIdmSectionPeer.php'; $this->aSectionRelatedByParentId = SectionPeer::retrieveByPK($this->parent_id, $con); } return $this->aSectionRelatedByParentId; }