On 8/27/07, Jonathan LaCour <[EMAIL PROTECTED]> wrote:
>
> Gaetan de Menten wrote:
>
> > Anyway, I'm on it. I'm currently rewriting the extension to be more
> > generic (ie support belongs_to relationships too) and better
> > integrated with the rest of Elixir.
>
> How is this coming along, Gaetan?

I've got a proof-of-concept code working in my local copy. But there
are some nasty bugs I discovered I have to talk to Michael about. Ben
conveniently avoided them by not providing the most important (at
least to me) part of the thing: the polymorphic relation itself.

Anyway, here is the syntax I've come up with:

class Address(Entity):
    has_field('street', String(130))
    has_field('city', String)
    has_and_belongs_to_many('addressees', of_kind=ANYKIND)

class Person(Entity):
    has_field('name', Unicode)
    has_and_belongs_to_many('addresses', of_kind='Address',
                            inverse='addressees')

class Order(Entity):
    has_field('order_num', Integer, primary_key=True)
    has_field('item_count', Integer)

    has_and_belongs_to_many('address', of_kind='Address',
                            inverse='addressees', uselist=False)

Any thoughts?

-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to