Oops, I was stomping on the fieldsByID property by treating it as a function instead of a hash. Also add in an assertion to check that insertField() is always called with a real field.

This commit is contained in:
ian%hixie.ch 2002-05-06 05:50:06 +00:00
Родитель 3afbf82b63
Коммит 24bcc8e7ed
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -197,7 +197,7 @@ sub getField {
sub getFieldByID {
my $self = shift;
my($ID) = @_;
my $field = $self->fieldsByID($ID);
my $field = $self->fieldsByID->{$ID};
if (not defined($field)) {
$field = $self->insertField($self->app->getService('user.fieldFactory')->createFieldByID($self->app, $self, $ID));
}
@ -343,6 +343,7 @@ sub levelInGroup {
sub insertField {
my $self = shift;
my($field) = @_;
$self->assert(ref($field) and $field->provides('user.field'), 1, 'Tried to insert something that wasn\'t a field object into a user\'s field hash');
$self->fields->{$field->category}->{$field->name} = $field;
$self->fieldsByID->{$field->fieldID} = $field;
return $field;