Uploaded image for project: 'Doctrine 1'
  1. Doctrine 1
  2. DC-993

Many-to-many Relation defined one way


    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.2.2, 1.2.3
    • Fix Version/s: None
    • Component/s: Relations
    • Labels:
    • Environment:
      MySQL database, Lenny


      When a many-tomany relation has been defined on only one of the end of the relation, and ofcourse in the cross-refClass, things get weird. I'll use the user-groups relation (as found in the documentation) as example.

      If in the group model has not defined the hasMany, then a user can be instantiated and saved. When instantiated, the relation groups would return an empty array, groups can ben added like:

      $u = new User();
      $u->groups[] = new Group();

      This would output an empty array, and subsequently an array containing the new group.

      However, if a user would be retrieved from the database, and the relation groups would be called, then the following message will appear (which is not helpfull at alllll, I've spend hours figuring it out!):

      Uncaught exception 'Doctrine_Record_UnknownPropertyException' with message 'Unknown record property / related component "groups"' .....

      I will never forget this, but it's not described in the documentation and the error is not helping either. So either one of these step hvae to be taken. Or even better, making it work without requiring the hasMany in group, to users.


        There are no comments yet on this issue.


          • Assignee:
            romanb Roman S. Borschel
            kweij Klaas van der Weij
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: