Re: Many to Many support for Maypole (patches)

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

From: Yuval Kogman
Subject: Re: Many to Many support for Maypole (patches)
Date: 13:59 on 22 Jun 2004
--GID0FwUMdk1T2AWN
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Jun 23, 2004 at 13:41:31 +0100, Tony Bowden wrote:

> Docs would be useful first so I can tell what you're actually doing :)

I'll start with some unformalized descriptions....

The first hunk of patch is a new sub to CDBI::Relationship::HasMany,
which gives you something like ->foreign_class, but instead talks about
the class that is at the end of the mapping chain.

In this example:

Gorch->has_a( bar =3D> 'Bar' );
Foo->has_many( bars [ 'Gorch' =3D> 'bar' ] );

foreign_class on foo's relationship will give Gorch, but mapped_class
will give Bar, because it asks the Gorch->has_a relationship what it's
got, since it's a mapping.


The next bit adds a request to add a 'remove_from_bars' method, when
this stuff is set up.

Then, a change to add_to_* will let you add objects that already exist,
without too much whyning, by asking to find_or_create the link, not just
create it.

_method_remove_from generates  the remove_from_bars method. It looks up
the that $self has $data in, and it deletes the object that has $self,
and that has $data, or has something that has data.

For unmapped relationships it simply zapped the foreign key pointing to
$self.

The last bit solves the stringification troubles, which allow deleting
links in the lookup tables to work.

--=20
 ()  Yuval Kogman <nothingmuch@xxxxxxxx.xxx> 0xEBD27418  perl hacker &
 /\  kung foo master: /me wields bonsai kittens: neeyah!!!!!!!!!!!!!!!!


--GID0FwUMdk1T2AWN
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFA2DsoVCwRwOvSdBgRAh1dAJ9PwaxsCDUGgekHrVl739n6vHFVqACgw052
wNLdeRai7NcnFDrhDflUDnY=
=ls2n
-----END PGP SIGNATURE-----

--GID0FwUMdk1T2AWN--

Many to Many support for Maypole (patches)
Yuval Kogman 01:13 on 22 Jun 2004

Re: Many to Many support for Maypole (patches)
William McKee 12:39 on 23 Jun 2004

Re: Many to Many support for Maypole (patches)
Yuval Kogman 13:50 on 22 Jun 2004

Re: Many to Many support for Maypole (patches)
Tony Bowden 15:24 on 23 Jun 2004

Re: Many to Many support for Maypole (patches)
Yuval Kogman 16:18 on 22 Jun 2004

Re: Many to Many support for Maypole (patches)
Tony Bowden 12:41 on 23 Jun 2004

Re: Many to Many support for Maypole (patches)
Yuval Kogman 13:59 on 22 Jun 2004

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