Moose overrides for purge, purgeRevision, and purgeCache.
This commit is contained in:
parent
7ba89245fa
commit
616d5cc866
36 changed files with 139 additions and 192 deletions
|
|
@ -342,15 +342,15 @@ Deletes all badges and things attached to the badges. No refunds are given.
|
|||
|
||||
=cut
|
||||
|
||||
sub purge {
|
||||
override purge => sub {
|
||||
my $self = shift;
|
||||
my $db = $self->session->db;
|
||||
$db->write("delete from EMSRegistrantTicket where badgeId=?",[$self->getId]);
|
||||
$db->write("delete from EMSRegistrantToken where badgeId=?",[$self->getId]);
|
||||
$db->write("delete from EMSRegistrantRibbon where badgeId=?",[$self->getId]);
|
||||
$db->write("delete from EMSRegistrant where badgeId=?",[$self->getId]);
|
||||
$self->SUPER::purge;
|
||||
}
|
||||
super();
|
||||
};
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -166,11 +166,11 @@ Deletes all entries in EMSRegistrationRibbon table for this sku. No refunds are
|
|||
|
||||
=cut
|
||||
|
||||
sub purge {
|
||||
override purge => sub {
|
||||
my $self = shift;
|
||||
$self->session->db->write("delete from EMSRegistrantRibbon where ribbonAssetId=?",[$self->getId]);
|
||||
$self->SUPER::purge;
|
||||
}
|
||||
super();
|
||||
};
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -451,11 +451,11 @@ Deletes all ticket purchases of this type. No refunds are given.
|
|||
|
||||
=cut
|
||||
|
||||
sub purge {
|
||||
override purge => sub {
|
||||
my $self = shift;
|
||||
$self->session->db->write("delete from EMSRegistrantTicket where ticketAssetId=?",[$self->getId]);
|
||||
$self->SUPER::purge;
|
||||
}
|
||||
super();
|
||||
};
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -159,11 +159,11 @@ Destroys all tokens of this type. No refunds are given.
|
|||
|
||||
=cut
|
||||
|
||||
sub purge {
|
||||
override purge => sub {
|
||||
my $self = shift;
|
||||
$self->session->db->write("delete from EMSRegistrantToken where tokenAssetId=?",[$self->getId]);
|
||||
$self->SUPER::purge;
|
||||
}
|
||||
super();
|
||||
};
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -746,7 +746,7 @@ Extend the base class to handle all file collateral.
|
|||
|
||||
=cut
|
||||
|
||||
sub purge {
|
||||
override purge => sub {
|
||||
my $self = shift;
|
||||
my $sth = $self->session->db->read("select image1, image2, image3, brochure, manual, warranty from Product where assetId=?", [$self->getId]);
|
||||
while (my @array = $sth->array) {
|
||||
|
|
@ -756,8 +756,8 @@ sub purge {
|
|||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$self->SUPER::purge();
|
||||
}
|
||||
super();
|
||||
};
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -767,11 +767,11 @@ Extends the base class to handle cleaning up the cache for this asset.
|
|||
|
||||
=cut
|
||||
|
||||
sub purgeCache {
|
||||
override purgeCache => sub {
|
||||
my $self = shift;
|
||||
$self->session->cache->delete("view_".$self->getId);
|
||||
$self->SUPER::purgeCache;
|
||||
}
|
||||
super();
|
||||
};
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -781,7 +781,7 @@ Extend the base method to handle deleting file collateral.
|
|||
|
||||
=cut
|
||||
|
||||
sub purgeRevision {
|
||||
override purgeRevision => sub {
|
||||
my $self = shift;
|
||||
WebGUI::Storage->get($self->session, $self->get("image1"))->delete if ($self->get("image1"));
|
||||
WebGUI::Storage->get($self->session, $self->get("image2"))->delete if ($self->get("image2"));
|
||||
|
|
@ -789,8 +789,8 @@ sub purgeRevision {
|
|||
WebGUI::Storage->get($self->session, $self->get("brochure"))->delete if ($self->get("brochure"));
|
||||
WebGUI::Storage->get($self->session, $self->get("manual"))->delete if ($self->get("manual"));
|
||||
WebGUI::Storage->get($self->session, $self->get("warranty"))->delete if ($self->get("warranty"));
|
||||
return $self->SUPER::purgeRevision;
|
||||
}
|
||||
return super();
|
||||
};
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -508,7 +508,7 @@ Remove all collateral associated with the ThingyRecord sku
|
|||
|
||||
=cut
|
||||
|
||||
sub purge {
|
||||
override purge => sub {
|
||||
my $self = shift;
|
||||
|
||||
my $options = { constraints => [ { 'assetId = ?' => $self->getId } ] };
|
||||
|
|
@ -520,8 +520,8 @@ sub purge {
|
|||
|
||||
# XXX: Should we also remove the records from the Thingy?
|
||||
|
||||
return $self->SUPER::purge;
|
||||
}
|
||||
return super();
|
||||
};
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue