[Catalyst] $c->user->some_relationship always retrives user id from the db

Moritz Onken onken at houseofdesign.de
Sat Feb 16 15:20:00 GMT 2008


If someone tells me where to put that kind of code Matt suggested I'll  
write a patch and some (1? :-) ) tests.


Am 15.02.2008 um 02:16 schrieb Guillermo Roditi:

>> Which means the entire thing would be pointless. What you want to do
>> really is
>>
>>  $class->new({ %saved_stuff, -result_source => $schema- 
>> >source($class) });
>>  $new_obj->in_storage(1);
>>
>> then it'll work "as if" you re-fetched the object (%saved_stuff  
>> being the
>> return of $obj->get_columns). Making stuff work with only the PK  
>> stashed
>> in the session is left as an exercise to the reader, but would  
>> probably
>> be best done using Data::Thunk and Data::Swap.
>
>
> /me confoos. Why not just use the shiny new freeze / thaw hooks?
> Wouldn't it make sense to store a frozen version of the User row /
> object in the session and then thaw it upon request? This seems like
> it would be a really natural way to cache this information. Ideally,
> the thawing would be a lazy operation as well  i think.
>
> I just bring this up because the code you just sent would not work
> when one is using things like DigestColumns or EncodedColumn, which
> are most commonly seen in User-type objects
>
> --Guillermo Roditi (groditi)
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/




More information about the Catalyst mailing list