On Sat, May 26, 2007 at 08:12:11PM +0200, Tobias Kremer wrote:
> >Wrapping clone() and compose_namespace() to overwrite the appropriate
> >key in class_mappings afterwards might do the trick?
> >
> >The problem is that DBIC keeps a reverse lookup of classes to  
> >sources to
> >deal with $schema->source($classname) - and the current relationship
> >declaration style requires that.
> 
> Any chance that there might be a solution to this in the near future? I
> honestly don't think I am able to patch this myself. Maybe if you
> elaborate some more on what needs to be added to DBIC to make this work.
> For instance, where would one specify a primary source for class if  
> needed?

That's not the answer. The answer is just to remove the need for class-based
lookups. It'll be less typing anyway.

The trouble is it needs somebody to have a proper think about how to still
DWIM relationships - I had this basically working where you provided an
explicit join condition everywhere but people kept reporting the fact that
it didn't auto-find the PK on the other side of a class that wasn't loaded
yet as a bug and in the end I gave up.

Most of the code is actually still in there, too - if you explicitly define
all your joins and switch to using the source name instead of class name
you're probably good.

> Have there already been discussions about this or am I the first one to
> encounter these difficulties? IMHO this really is a serious issue
> because it makes using custom SQL with the result_source_instance trick
> quite unusable or at least unstable.

Alternatively, a nasty 2-line workaround -

@My::Schema::UserView::ISA = ('My::Schema::User');
$source->result_class('My::Schema::UserView');

proceed as normal :)

-- 
      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/

Reply via email to