Propel icon indicating copy to clipboard operation
Propel copied to clipboard

"Call to undefined method..." error, in generated base class when use more than two foreign keys

Open mladen-babic opened this issue 10 years ago • 2 comments

I have this in my "schema.xml" :

  <table name="user_role_company" isCrossRef="true">
    <column name="user_id" type="INTEGER" primaryKey="true"/>
    <column name="role_id" type="INTEGER" primaryKey="true"/>
    <column name="company_id" type="INTEGER" primaryKey="true"/>
    <foreign-key foreignTable="user" phpName="Urc_User" onDelete="CASCADE">
      <reference local="user_id" foreign="id"/>
    </foreign-key>
    <foreign-key foreignTable="role" phpName="Urc_Role" onDelete="CASCADE">
      <reference local="role_id" foreign="id"/>
    </foreign-key>
    <foreign-key foreignTable="company" phpName="Urc_Company" onDelete="CASCADE">
      <reference local="company_id" foreign="id"/>
    </foreign-key>
  </table>

and Propel generated, in "User.php" base class "User" with this method :

    public function getUrc_Roles(ChildCompany $urc_Company = null, Criteria $criteria = null, ConnectionInterface $con = null)
    {
        return $this->createUrc_RolesQuery($urc_Company, $criteria)->find($con);
    }

but method "createUrc_RolesQuery" does not exist in "User.php", and when I call this method, get : "Call to undefined method: createUrc_RolesQuery" error message.

Please, help.

mladen-babic avatar Jan 15 '16 17:01 mladen-babic

Can you please try to not use underscore in phpName="" attributes?

marcj avatar Jan 15 '16 18:01 marcj

marcj, thanks for you response.

No results. After changing the value of "phpName" attribute, the problem persists.

mladen-babic avatar Jan 15 '16 18:01 mladen-babic