[Catalyst] $c->user->some_relationship always retrives user id
from the db
Matt S Trout
dbix-class at trout.me.uk
Sun Feb 17 14:38:05 GMT 2008
On Thu, Feb 14, 2008 at 08:16:45PM -0500, Guillermo Roditi wrote:
> > 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?
Because I often forget about those.
> 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.
Sure, but you still need the thunk tricks to handle partial lazyness.
Or a complete rewrite of the way result objects are built, which I keep
considering ;)
> 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
Don't those allow you to have a 'password' attribute stored in a
'password_hash' column or similar now?
Anything else is going to clash somewhere or other.
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
More information about the Catalyst
mailing list