[Dbix-class] Adding a relationship at runtime.

Oleg Pronin syber.rus at gmail.com
Mon Jun 4 17:22:05 GMT 2007


Well, i have users and games.
Each user has a general result row for each game (usergame, has column
rating, settings etc).

user -> has_many usergames

Each game has the perl server (daemon). And inside those server
the relationship between user and usergame become exactly has_one.

I want to add 'has_one' relationship inside the perl server (the schema has
already been created at this momemt) and proxy common usergame columns to
simply call
$user->rating, $user->settings etc.


2007/6/4, Matt S Trout <dbix-class at trout.me.uk>:
>
> On Mon, Jun 04, 2007 at 02:19:55PM +0400, Oleg Pronin wrote:
> > After the schema has been created i want to add a relationship.
> >
> > $schema->source('User')->add_relationship(......);
> >
> > But it doesn't do register_relationship because $schema->source('User')
> is
> > an 'DBIx::Class::ResultSource::Table' object and it has no
> > 'DBIx::Class::ResultSourceProxy' in MRO which does.
> >
> > If i add relationship to result class then it won't affect my schema
> because
> > it have already made the copies of sources.
> >
> > How to?
>
> There are a few possibilities. Step back from what you're having trouble
> implementing and tell us what you're trying to achieve.
>
> --
>      Matt S Trout       Need help with your Catalyst or DBIx::Class
> project?
>   Technical Director    Want a managed development or deployment platform?
> Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a
> quote
> http://chainsawblues.vox.com/
> http://www.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/
> Searchable Archive:
> http://www.mail-archive.com/dbix-class@lists.rawmode.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20070604/eb4=
da4a8/attachment.htm


More information about the Dbix-class mailing list