Skip to content

Commit e707560

Browse files
fix: allow indexing models with parents
1 parent 9b27398 commit e707560

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Core/ModelCache.inc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -110,23 +110,6 @@ class ModelCache {
110110
);
111111
}
112112

113-
# Models with parent model classes cannot be indexed
114-
if ($model->parent_model_class) {
115-
throw new ServerError(
116-
message: "Cannot index Model class '" .
117-
$model->get_class_fqn() .
118-
"' because it has a parent model class '" .
119-
$model->parent_model_class .
120-
"'.",
121-
response_id: 'MODEL_CACHE_INDEX_FIELD_ON_PARENTED_MODEL',
122-
);
123-
}
124-
125-
# If indexing by 'id', it's always unique
126-
if ($index_field === 'id') {
127-
return;
128-
}
129-
130113
# Check if the index field is unique on the Model object
131114
if (!$model->$index_field->unique) {
132115
throw new ServerError(

0 commit comments

Comments
 (0)