"Call to undefined method" in generated class for more than two foreign keys
donholgo opened this issue · 1 comments
donholgo commented
When generating classes for a schema with more than two foreign keys, not all methods are created.
This can be reproduced with the example from the "More than two foreign keys" section in the documentation: After creating the example schema
<database name="demo" defaultIdMethod="native">
<table name="user">
<column name="id" type="integer" primaryKey="true"/>
</table>
<table name="group">
<column name="id" type="integer" primaryKey="true"/>
</table>
<table name="type">
<column name="id" type="integer" primaryKey="true"/>
</table>
<table name="user_group" isCrossRef="true">
<column name="user_id" type="integer" primaryKey="true"/>
<column name="group_id" type="integer" primaryKey="true"/>
<column name="type_id" type="integer" primaryKey="true"/>
<foreign-key foreignTable="user">
<reference local="user_id" foreign="id"/>
</foreign-key>
<foreign-key foreignTable="group">
<reference local="group_id" foreign="id"/>
</foreign-key>
<foreign-key foreignTable="type">
<reference local="type_id" foreign="id"/>
</foreign-key>
</table>
</database>
and running propel model:build
, the generated Base/User.php
contains calls
return $this->createGroupsQuery($type, $criteria)->find($con);
(in getGroups
and countGroups
), but there is no method createGroupsQuery
defined. Same for createUsersQuery
in Base/Group.php
and Base/Type.php
.
donholgo commented
This seems to have been a problem in Propel 1 already: propelorm/Propel#1019