On Fri, Feb 22, 2008 at 5:26 PM, Michael Bayer <[EMAIL PROTECTED]> wrote:
>
>
>
> On Feb 21, 11:22 pm, Alexandre da Silva <[EMAIL PROTECTED]> wrote:
> > Em Qui, 2008-02-21 às 11:51 -0800, Michael Bayer escreveu:> Elixir is
> probably using a backref for the bi-directional
> > > relationship
> >
> > yes, as I was testing I got the same.
> > but I think Elixir does not need to create the backref, in this case,
> > because I am creating the "person" column on goal, and this supplies the
> > relationship.
> > I think maybe Elixir is doing something unnecessary here.
> >
> > class Goal(Entity):
> > person = ManyToOne('Person')
> >
> > class Person(Entity):
> > goals = OneToMany('Goal')
> >
> > and other... why it does not throw an exception by duplicated attribute,
> > since that the auto created backref should be exactly "person"?
> >
>
> its creating the "person" backref in response to your
> ManyToOne('Person') call. I.e. it detects that "goals" and "person"
> are two sides of the same coin and sets them up as a backref. So if
> you removed "person" then there wouldn't be a backref. Perhaps theres
> an option to keep them as non-connected relations.
No, there isn't such option currently. But I don't think it would make
sense to add one (at least for this particular case) because a O2M
relationship cannot exist without its corresponding M2O (because the
column containing the FK is created by the M2O).
--
Gaëtan de Menten
http://openhex.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SQLElixir" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---