[Dbix-class] stupid ?: how to create new objects & save them?
Jess Robinson
castaway at desert-island.demon.co.uk
Sat Apr 1 10:39:36 CEST 2006
On Fri, 31 Mar 2006, Mark Hedges wrote:
>
> It isn't obvious to me why I can't do this:
>
> my $newsletter = $customer->newsletter;
> my $customer_email = $customer->customer_email;
>
> if (!$newsletter) {
> $newsletter = C::Newsletter->new({
> email => $customer_email
> });
> warn "newsletter is a '$newsletter'\n";
> # says it's a C::Newsletter
> }
> $newsletter->weekly(1);
> $customer->newsletter( $newsletter );
> $newsletter->update;
> $customer->update;
>
> I get this error:
>
> DBIx::Class::InflateColumn::update(): Not in database at <myscript> line 51
That is how you create objects and save them. However I think you may want
to call ->update on the newsletter, before you try and set the
$customer->newsletter value with in.
Did you manage to isolate just which of those calls is producing that
inflate error?
Jess
More information about the Dbix-class
mailing list