Sorry for the barrage of emails, but I think I have come to some
conclusions after reviewing  ManyToMany.pm. Can anyone confirm or deny
the following?

1) The My::DBO::Item->map_record method is created during class
relationship initialization and is therefore always available on any
object of type My::DBO::Item at any time.

2) If there are more than one many_to_many relationships defined that
map to My::DBO::Item, then My::DBO::Item->map_record is created over
and over again during class relationship initialization, each time
overwriting the previously defined method.

3) An $item object of type My::DBO::Item, created by new() has an
$item->map_record method that if called called without any arguments,
(and no map_records have been previously defined for the object) a
new, empty map_record is arbitrarily created, stored and returned for
the object.

4) As per #3, the new map_record that is created for the object will
be of whatever map class was last defined as a many_to_many pointing
to My::DBO::Item (as per #2).

If I understand the above correctly, then the bug I am running into is
by design, and I guess I should just use $item->map_record a lot more
carefully..



On 4/11/07, Derek Watson <[EMAIL PROTECTED]> wrote:
> One more thing, I am now testing this code outside of mod_perl and
> getting the same results.
>
> On 4/11/07, Derek Watson <[EMAIL PROTECTED]> wrote:
> > > No, the Manager does no caching.  Given the code you posted, I can't
> > > see a way that this could ever happen.  Map records only (optionally,
> > > and not by default) appear when you're asking for a many-to-many
> > > relationship in your Manager call using the with_objects or
> > > require_objects parameters.  Can you give me some working sample code
> > > that reproduces the problem?
> >
> > I'll try my best to come up with that test code, but it will be sort
> > of complicated. I believe the problem has something to do with many
> > classes having many_to_many relationships pointing to the same class,
> > for example
> >
> > My::DBO::Package defines
> >   relationships =>
> >   [
> >     items =>
> >     {
> >       type        => 'many to many',
> >       map_class   => 'My::DBO::PackageItemMap',
> >       map_from    => 'package',
> >       map_to      => 'item',
> >       manager_args=> { with_map_records => 1, },
> >     },
> >
> >   ],
> >
> > and My::DBO::Person also defines
> >   relationships =>
> >   [
> >     items =>
> >     {
> >       type        => 'many to many',
> >       map_class   => 'My::DBO::PersonItemMap',
> >       map_from    => 'person',
> >       map_to      => 'item',
> >       manager_args=> { with_map_records => 1, },
> >     },
> >   ],
> >
> > My test case is now as simple as:
> >
> > my $item = My::DBO::Item->new;
> > die $item->map_record; # My::DBO::PackageItemMap=HASH(0xa919514)
> >
> > When I comment out the with_map_records line in PackageItemMap and run
> > the test again:
> >
> > my $item = My::DBO::Item->new;
> > die $item->map_record; # My::DBO::PersonItemMap=HASH(0xa919514)
> >
> > It goes to the next in the chain.  If I comment out all with_map_records,
> >
> > Can't locate object method "map_record" via package "My::DBO::Item" at
> > /usr/lib/perl5/site_perl/5.8.8/Rose/DB/Object.pm line 1500
> >
> > Thank you in advance for any insight you may have. I believe my class
> > setup is cross-wired somehow.
> >
>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to