Can we make might_have() relationships easier to use?

[prev] [thread] [next] [Date index for 2004/06/04]

From: Edward J. Sabol
Subject: Can we make might_have() relationships easier to use?
Date: 06:04 on 04 Jun 2004
I recently added a might_have() relationship to the CDBI framework I use in
an application I've been developing, and it really complicated the update and
create methods of my controller class. Compared to has_many() relationships,
might_have()s are not nearly as convenient to populate.

What do you think about having an "add_*" method similar to has_many()'s
"add_to_*"?

E.g.,

    Music::CD->might_have(foo => Other::Class => (qw(bar baz));
    $cd->add_foo({ bar => 'some value', baz => 'other value' });

Ideally, I think "$cd->bar('some value');" should transparently create the
other record if necessary. It seems like 0.95 ties to do so, but with a null
primary key instead of using the primary key of $cd. (I haven't tested this
with 0.96.)

Later,
Ed

(message missing)

Can we make might_have() relationships easier to use?
Edward J. Sabol 06:04 on 04 Jun 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52