Deleting might_have records
[prev]
[thread]
[next]
[Date index for 2004/08/19]
An observation from a CDBI learner:
If you delete a record linked via might_have, you need to reload your
record or else you will get relationship errors.
Given the following DBI (partial) definition:
package DBI::PurchaseLimitsOverride;
use base qw(DBI);
__PACKAGE__->table('purchase_limits_override');
__PACKAGE__->columns(All => qw/user_id purchase_limit ctime/);
__PACKAGE__->has_a(user_id => 'DBI::Users');
package DBI::Users;
use base qw(DBI);
__PACKAGE__->might_have(purchase_limits_override => 'DBI::PurchaseLimitsOverride' => qw/purchase_limit/);
Use the following two lines to safely remove the linked record (assuming
$user is a DBI::Users object):
$user->puchase_limits_override->delete;
$user = DBI::Users->retrieve($user_id);
William
--
Knowmad Services Inc.
http://www.knowmad.com
|
Deleting might_have records
William McKee 14:11 on 19 Aug 2004
|