Doctrine 1
  1. Doctrine 1
  2. DC-993

Many-to-many Relation defined one way

    Details

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

      Description

      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();
      var_dump($u->groups);
      $u->groups[] = new Group();
      var_dump($u->groups);
      

      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.

        Activity

        There are no comments yet on this issue.

          People

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

            Dates

            • Created:
              Updated: