On Wed, 22 Aug 2007, Paul Makepeace wrote:

I have a standard has_many linking multiple groups profiles to a
particular user,

 My::Schema::User->has_many(user_profile => 'My:Schema::UserProfile',
        { 'foreign.user_uid' => 'self.uid', } );

UserProfile is the link class ("join") table: user_uid, profile_uid

I'd like to be able to set a bunch of profile_uids and have the ORM
sort out which need deletion and creation. Is this possible?

I'm not missing something am I? My code does the equivalent of this:

$user->user_profiles->delete;
$user->create_realted('user_profiles', {profile_id => $_}) for @profiles;

(those can be profile objects or IDs, both work)

I looked in the cookbook and there's examples on building the
relationships ({has,many_to}_many) but not much (anything?) on using
them.

::Manual::Joining should have this sorta stuff in, but may not yet.

Jess


_______________________________________________
List: http://lists.rawmode.org/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/[EMAIL PROTECTED]

Reply via email to