[Dbix-class] update and join

Darius Jokilehto dariusjokilehto at yahoo.co.uk
Thu Nov 13 12:46:10 GMT 2014


On Thursday, 13 November 2014, 11:36, RAPPAZ Francois <francois.rappaz at unifr.ch> wrote:



[...]
>
>
>I have two tables joined by a "belongs to" and a "has many" relationship
>      Ddref
>           idref iduser finished created
>           n    n--------------+
>           ^                   ¦
>           ¦                   ¦RefUser (bt iduser)
>           ¦UserRef (hm)       ¦
>           ¦                   ¦
>           1     1<------------+
>           Dduser
>           iduser email id_credit
>
>idref is a primary key for Ddref
>iduser is a pk for Dduser
>
>In Dduser.pm
>__PACKAGE__->belongs_to(RefUser=> 'Dbc::Schema::Result::Dduser',  {'foreign.iduser' => 'self.iduser'});

>

This relationship is incorrect - it's pointing to itself.

Hope that helps,

Darius



More information about the DBIx-Class mailing list