Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Call to undefined method" in generated class for more than two foreign keys #1961

Open
donholgo opened this issue Mar 23, 2023 · 1 comment

Comments

@donholgo
Copy link

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
Copy link
Author

This seems to have been a problem in Propel 1 already: propelorm/Propel#1019

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

No branches or pull requests

1 participant