From 1331bf9828136c9357e663fa55feb894ddd3b310 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 14 Jan 2010 10:31:38 -0800 Subject: [PATCH] Remove more instances of direct hash access for properties. --- lib/WebGUI/AssetTrash.pm | 2 +- lib/WebGUI/AssetVersioning.pm | 17 +++++++++-------- t/Asset.t | 7 +++++++ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/lib/WebGUI/AssetTrash.pm b/lib/WebGUI/AssetTrash.pm index d9a1fdcd2..7829b84fc 100644 --- a/lib/WebGUI/AssetTrash.pm +++ b/lib/WebGUI/AssetTrash.pm @@ -292,7 +292,7 @@ sub trash { $db->commit; # Update ourselves since we didn't use update() - $self->{_properties}{state} = "trash"; + $self->state("trash"); return 1; } diff --git a/lib/WebGUI/AssetVersioning.pm b/lib/WebGUI/AssetVersioning.pm index 17dfdde35..5cb9bb5fe 100644 --- a/lib/WebGUI/AssetVersioning.pm +++ b/lib/WebGUI/AssetVersioning.pm @@ -472,9 +472,10 @@ Sets the versioning lock to "on" so that this piece of content may not be edited =cut sub setVersionLock { - my $self = shift; - $self->session->db->write("update asset set isLockedBy=? where assetId=?", [$self->session->user->userId, $self->getId]); - $self->{_properties}{isLockedBy} = $self->session->user->userId; + my $self = shift; + my $session = $self->session; + $session->db->write("update asset set isLockedBy=? where assetId=?", [$session->user->userId, $self->getId]); + $self->isLockedBy($session->user->userId); $self->updateHistory("locked"); $self->purgeCache; } @@ -492,12 +493,12 @@ A new version tag id. =cut sub setVersionTag { - my $self = shift; + my $self = shift; my $tagId = shift; $self->session->db->write("update assetData set tagId=? where assetId=? and tagId = ?", [$tagId, $self->getId,$self->get('tagId')]); - $self->{_properties}{tagId} = $tagId; - $self->updateHistory("changed version tag to $tagId"); - $self->purgeCache; + $self->tagId($tagId); + $self->updateHistory("changed version tag to $tagId"); + $self->purgeCache; } @@ -527,7 +528,7 @@ Sets the versioning lock to "off" so that this piece of content may be edited on sub unsetVersionLock { my $self = shift; $self->session->db->write("update asset set isLockedBy=NULL where assetId=?",[$self->getId]); - $self->{_properties}{isLockedBy} = undef; + $self->isLockedBy(undef); $self->updateHistory("unlocked"); $self->purgeCache; } diff --git a/t/Asset.t b/t/Asset.t index 40f1c9ee8..796a44afa 100644 --- a/t/Asset.t +++ b/t/Asset.t @@ -185,4 +185,11 @@ my $session = WebGUI::Test->session; $session->db->write("delete from asset 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); }