[CDBI] TEMP columns not persisting through $self->add_to_<something>s

Matt S Trout dbix-class at trout.me.uk
Tue May 15 08:59:26 BST 2007

On Mon, May 14, 2007 at 10:52:11PM -0400, Perrin Harkins wrote:
> On 5/14/07, Berg, Eric <eric.berg at lehman.com> wrote:
> >But basically, I call the method that does the add_to_actions(), and
> >when I return from that method, the temp columns in the Action objects
> >that I get with $test->actions have only the Primary column.
> Hmm, I think that's what I just said.  When you return from
> load_action_defs(), unless you pass references to the objects you
> created, they are gone forever, along with all their TEMP data.  When
> you call actions(), it fetches fresh objects from the database, and of
> course they have no TEMP values.

A has_many relationship doesn't push the added value onto internal
storage - calling it results in a re-fetch from the DB so assuming the
original went out of scope you'll get a fresh object.

If you keep the original in scope -and- have the LOI on it might appear to
work, but I'd advise strongly against relying on that.

      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/ 

More information about the ClassDBI mailing list