Skip to content
This repository has been archived by the owner on Jan 4, 2020. It is now read-only.

使用关联模型MANY_TO_MANY关联不能获取关联表的字段 #33

Open
phpcxy opened this issue Mar 21, 2013 · 0 comments
Open

使用关联模型MANY_TO_MANY关联不能获取关联表的字段 #33

phpcxy opened this issue Mar 21, 2013 · 0 comments

Comments

@phpcxy
Copy link
Contributor

phpcxy commented Mar 21, 2013

如果把RelationModel.class.php的180行

原来的:

$sql = "SELECT b.{$mappingFields} FROM {$mappingRelationTable} AS a, ".$model->getTableName()." AS b WHERE a.{$mappingRelationFk} = b.{$model->getPk()} AND a.{$mappingCondition}";

改为:

$sql = "SELECT {$mappingFields} FROM {$mappingRelationTable} AS a, ".$model->getTableName()." AS b WHERE a.{$mappingRelationFk} = b.{$model->getPk()} AND a.{$mappingCondition}";

自己定义$mappingFields来查询那个表那个字段。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant