[Dbix-class] Scalar ref update()'s
Marc Mims
marc at questright.com
Thu May 15 20:04:22 BST 2008
* Jose Fonseca <zefonseca at gmail.com> [080515 12:00]:
> $subscription->end_date( \'DATE_ADD(NOW(), INTERVAL 12 MONTH)' );
> $subscription->update();
>
> It works a dandy, check the row and MySQL replies with a brand new 12 month.
>
> But now, whenever I read
>
> $end_date = $subscription->end_date();
>
> I get a reference to \'DATE_ADD(NOW(), INTERVAL 3 MONTH)' and not the new
> computed value. It seems we're missing a back and forth trip to the RDBMS?
Although the back-end DB has been updated, the object in memory has no
way of knowing what value the DB assigned. Re-read from the DB to
update the object:
$subscription->discard_changes;
-Marc
More information about the DBIx-Class
mailing list