in reply to Re: DBIC circular relationship
in thread DBIC circular relationship

I'm not apposed to doing at with a trigger but how would I do it in a DBIC model? I figured it would either be some cool way of writing one of the relationships or a trigger - I was mainly trying to do it with a relationship but since you mentioned it, I've been looking and I cannot figure out how to write the trigger in DBIC.

Replies are listed 'Best First'.
Re^3: DBIC circular relationship
by NetWallah (Canon) on Apr 14, 2013 at 21:21 UTC
    I don't have sufficient experience in DBIC to come up with this, but the documentation looks promising:

    From : "See the distinction between create and new in DBIx::Class::ResultSet for details."

    To create related objects, pass a hashref of related-object column values keyed on the relationship name. If the relationship is of type multi ("has_many" in DBIx::Class::Relationship) - pass an arrayref of hashrefs. The process will correctly identify columns holding foreign keys, and will transparently populate them from the keys of the corresponding relation. This can be applied recursively, and will work correctly for a structure with an arbitrary depth and width, as long as the relationships actually exists and the correct column data has been supplied.
    I'm not sure exactly what it means, but it seems to be a way to update related fkeys.

    If you do figure this out, please post a synopsis here.

                 "I'm fairly sure if they took porn off the Internet, there'd only be one website left, and it'd be called 'Bring Back the Porn!'"
            -- Dr. Cox, Scrubs