[Dbix-class] RecursiveUpdate and many to many

Zbigniew Lukasiak zzbbyy at gmail.com
Sat Sep 27 20:19:06 BST 2008


On Sat, Sep 27, 2008 at 8:59 PM, Matt S Trout <dbix-class at trout.me.uk> wrote:
> On Sat, Sep 27, 2008 at 09:54:44AM +0200, Zbigniew Lukasiak wrote:
>> Hi Matt,
>>
>> I would like to include your critisizm of the support for many to many
>> in RecursiveUpdate in it's documentation.  Tell me if I get it right.
>> What I remember is two points:
>>
>> 1. That I rely on the fact that
>>
>> if($object->can($name) and
>>             !$object->result_source->has_relationship($name) and
>>             $object->can( 'set_' . $name )
>>         )
>>
>> then $name must be a many to many pseudo relation.  And that in a
>> similarly ugly was I find out what is the ResultSource of objects from
>> that many to many pseudo relation.
>>
>> 2. That I treat uniformly relations and many to many (which are
>> different from relations because they require traversal of the bridge
>> table).
>>
>> Is that right?
>
> Precisely, which means your code is fragile and implicitly broken.
>

Just to focus the discussion - you are referring here to 1) or 2)?

> If you really want to support such a feature, then you should make it
>
> (a) optional
> (b) off by default
>
> since it can't currently be done safely, and anything non-safe in code
> that's designed to talk to your production DB is -bad-.
>
> --
>      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
>   Technical Director                    http://www.shadowcat.co.uk/catalyst/
>  Shadowcat Systems Ltd.  Want a managed development or deployment platform?
> http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.rawmode.org
>



-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/



More information about the DBIx-Class mailing list