Remove more instances of direct hash access for properties.

This commit is contained in:
Colin Kuskie 2010-01-14 10:31:38 -08:00
parent 8664d6f6ef
commit 1331bf9828
3 changed files with 17 additions and 9 deletions

View file

@ -292,7 +292,7 @@ sub trash {
$db->commit; $db->commit;
# Update ourselves since we didn't use update() # Update ourselves since we didn't use update()
$self->{_properties}{state} = "trash"; $self->state("trash");
return 1; return 1;
} }

View file

@ -472,9 +472,10 @@ Sets the versioning lock to "on" so that this piece of content may not be edited
=cut =cut
sub setVersionLock { sub setVersionLock {
my $self = shift; my $self = shift;
$self->session->db->write("update asset set isLockedBy=? where assetId=?", [$self->session->user->userId, $self->getId]); my $session = $self->session;
$self->{_properties}{isLockedBy} = $self->session->user->userId; $session->db->write("update asset set isLockedBy=? where assetId=?", [$session->user->userId, $self->getId]);
$self->isLockedBy($session->user->userId);
$self->updateHistory("locked"); $self->updateHistory("locked");
$self->purgeCache; $self->purgeCache;
} }
@ -492,12 +493,12 @@ A new version tag id.
=cut =cut
sub setVersionTag { sub setVersionTag {
my $self = shift; my $self = shift;
my $tagId = shift; my $tagId = shift;
$self->session->db->write("update assetData set tagId=? where assetId=? and tagId = ?", [$tagId, $self->getId,$self->get('tagId')]); $self->session->db->write("update assetData set tagId=? where assetId=? and tagId = ?", [$tagId, $self->getId,$self->get('tagId')]);
$self->{_properties}{tagId} = $tagId; $self->tagId($tagId);
$self->updateHistory("changed version tag to $tagId"); $self->updateHistory("changed version tag to $tagId");
$self->purgeCache; $self->purgeCache;
} }
@ -527,7 +528,7 @@ Sets the versioning lock to "off" so that this piece of content may be edited on
sub unsetVersionLock { sub unsetVersionLock {
my $self = shift; my $self = shift;
$self->session->db->write("update asset set isLockedBy=NULL where assetId=?",[$self->getId]); $self->session->db->write("update asset set isLockedBy=NULL where assetId=?",[$self->getId]);
$self->{_properties}{isLockedBy} = undef; $self->isLockedBy(undef);
$self->updateHistory("unlocked"); $self->updateHistory("unlocked");
$self->purgeCache; $self->purgeCache;
} }

View file

@ -185,4 +185,11 @@ my $session = WebGUI::Test->session;
$session->db->write("delete from asset where assetId=?", [$testId]); $session->db->write("delete from asset where assetId=?", [$testId]);
$session->db->write("delete from assetData where assetId=?", [$testId]); $session->db->write("delete from assetData where assetId=?", [$testId]);
$testData->{hashAccess} = 'stuffed value';
diag $testData->{hashAccess};
}
{
my $home = WebGUI::Asset->getDefault($session);
} }