[Dbix-class] weird result_source_instance problem

Tobias Kremer list at funkreich.de
Fri May 25 14:48:41 GMT 2007


> > >> Correction: Calls to standard relationships DO work fine but I
> > >> have custom
> > >> methods in MyApp::Schema::User that use these relationships and
> > >> they stop
> > >> working:
> > >
> > > Can you show the calling code, please?
>
> Ok, I tried to strip down my schema so that you can have a look at it:
>
> http://www.funkreich.de/files/dbic_wreck.tar.gz

Check out this dump of $user->result_source->schema(). Just by changing
the name given to register_source the class mapping changes
(pay attention to Wreck::Schema::User).

------------------------------------------------------------------
Wreck::Schema->register_source( 'UserMutual' => $source_mutual );
------------------------------------------------------------------
'class_mappings' => {
    'Wreck::Schema::D' => 'D',
    'Wreck::Schema::UserRelation' => 'UserRelation',
    'Wreck::Schema::J' => 'J',
    'Wreck::Schema::C' => 'C',
    'Wreck::Schema::K' => 'K',
    'Wreck::Schema::G' => 'G',
    'Wreck::Schema::A' => 'A',
    'Wreck::Schema::F' => 'F',
    'Wreck::Schema::User' => 'User',
    'Wreck::Schema::M' => 'M',
    'Wreck::Schema::I' => 'I',
    'Wreck::Schema::H' => 'H',
    'Wreck::Schema::E' => 'E',
    'Wreck::Schema::L' => 'L',
    'Wreck::Schema::B' => 'B'
};

------------------------------------------------------------------
Wreck::Schema->register_source( 'MyResultSource' => $source_mutual );
------------------------------------------------------------------
'class_mappings' => {
    'Wreck::Schema::D' => 'D',
    'Wreck::Schema::UserRelation' => 'UserRelation',
    'Wreck::Schema::J' => 'J',
    'Wreck::Schema::C' => 'C',
    'Wreck::Schema::K' => 'K',
    'Wreck::Schema::G' => 'G',
    'Wreck::Schema::A' => 'A',
    'Wreck::Schema::F' => 'F',
    'Wreck::Schema::User' => 'MyResultSource',
    'Wreck::Schema::M' => 'M',
    'Wreck::Schema::I' => 'I',
    'Wreck::Schema::H' => 'H',
    'Wreck::Schema::E' => 'E',
    'Wreck::Schema::L' => 'L',
    'Wreck::Schema::B' => 'B'
};

--Tobias



More information about the Dbix-class mailing list