[Dbix-class] using HasMany with object references

Justin Guenther jguenther at gmail.com
Tue Dec 6 00:28:19 CET 2005


On 12/2/05, Matt S Trout <dbix-class at trout.me.uk> wrote:

> Assuming the other side has a belongs_to set up, just calling
>
> $foo_obj->belongs_to_rel($obj_which_has_many_foo);
>
> should do the trick.


The class does have belongs_to set up, but there doesn't seem to be a method
called belongs_to_rel

Here's my setup code:

In the class Treatment: (which has_many Phases)
...
__PACKAGE__->has_many('phases' => 'SaskSAGE::Model::DBIC::Phase',
                      'treatment_id');
...

In the class Phase: (which belongs_to Treatment)

...
__PACKAGE__->belongs_to('treatment_id' =>
'SaskSAGE::Model::DBIC::Treatment');
...

I'm trying to add a phase to a treatment by calling

$phase->belongs_to_rel($treatment);

but this method does not exist.

Any ideas?

--
>      Matt S Trout       Offering custom development, consultancy and
> support
>   Technical Director    contracts for Catalyst, DBIx::Class and BAST.
> Contact
> Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more
> information
>
> + Help us build a better perl ORM:
> http://dbix-class.shadowcatsystems.co.uk/ +
>
> _______________________________________________
> List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> Wiki: http://dbix-class.shadowcatsystems.co.uk/
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/dbix-class/attachments/20051205/d7b65aab/attachment.htm


More information about the Dbix-class mailing list