绝对有可能,只需将列添加到您的cross_ref
表中:
<table name="contact_opportunity" isCrossRef="true">
<column name="contact_id" type="INTEGER" primaryKey="true"/>
<column name="opportunity_id" type="INTEGER" primaryKey="true"/>
<!-- your new field -->
<column name="association_type" type="VARCHAR" required="true" />
<foreign-key foreignTable="contact">
<reference local="contact_id" foreign="id"/>
</foreign-key>
<foreign-key foreignTable="opportunity">
<reference local="opportunity_id" foreign="id"/>
</foreign-key>
</table>
然后你可以像其他任何东西一样查询它:
$association = ContactOpportunityQuery::create()
->filterByContact($contact)
->filterByOpportunity($opportunity)
->findOne();
$association->getAssociationType();