Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Problem inserting circular object references
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
scott  
View profile   Translate to Translated (View Original)
 More options 3 July, 22:33
From: scott <sc...@danielfamily.com>
Date: Fri, 3 Jul 2009 14:33:54 -0700 (PDT)
Local: Fri 3 July 2009 22:33
Subject: Problem inserting circular object references
We have a fairly classic User, Group, and GroupHasUser kind of schema
with a couple of small twists. The User owns a group and the Group
owns a user (the author of the group). You can see a stripped down
version of the schema below.

The plan was for a newly constructed User object to configure the
group that it owned. The result is that the User contains a Group
object and the Group object contains a GroupHasUser object with the
original User a member of the Group (thus the circular reference).

Saving the User results in the Group being inserted and then Doctrine
tries to make the GroupHasUser without creating the User first. The
result is an error. What it needs to do is create the Group, then
create the User, and finally the GroupHasUser.

It there some way to make this happen in the right order?

Thanks,

Scott

[schema]
Groups:
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true
    group_name:
      type: string(64)
    author_id: integer(4)
  relations:
    Author:
      class: User
      local: author_id
      foreign: id
      type: one
    Users:
      class: User
      local: group_id
      foreign: user_id
      refClass: GroupHasUser
User:
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true
    user_name:
      type: string(50)
      notnull: true
    friend_group_id: integer(4)
  relations:
    Groups:
      local: user_id
      foreign: group_id
      refClass: GroupHasUser
    FriendGroup:
      class: FriendGroup
      local: friend_group_id
      foreign: id
      type: one
FriendGroup:
      inheritance:
        extends: Groups
        type: column_aggregation
        keyField: type
        keyValue: 1
GroupHasUser:
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true
    user_id:
      type: integer(4)
      notnull: true
    group_id:
      type: integer(4)
      notnull: true
  relations:
    User:
      local: user_id
      foreign: id
      type: one
    Group:
      class: Groups
      local: group_id
      foreign: id
      type: one


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google