octobercms/october · error · ApplicationException

The model class :model must define a method :method() return

Error message

The model class :model must define a method :method() returning options for the ':filter' filter.

What it means

Error "The model class :model must define a method :method() returning options for the ':filter' filter." thrown in octobercms/october.

Source

Thrown at modules/backend/filterwidgets/Group.php:281

            if (
                count($staticMethod = explode('::', $options)) === 2 &&
                is_callable($staticMethod)
            ) {
                $options = $staticMethod($model, $scope);

                if (!is_array($options)) {
                    throw new ApplicationException(Lang::get('backend::lang.field.options_static_method_invalid_value', [
                        'class' => $staticMethod[0],
                        'method' => $staticMethod[1]
                    ]));
                }
            }
            // Calling via $model->method
            else {
                $methodName = $options;

                if (!$model->methodExists($methodName)) {
                    throw new ApplicationException(Lang::get('backend::lang.filter.options_method_not_exists', [
                        'model'  => get_class($model),
                        'method' => $methodName,
                        'filter' => $scope->scopeName
                    ]));
                }

                // For passing to events
                // @deprecated v4 review this interface to closer resemble the form field
                // interface (FormField and FilterScope)
                $holder = new ElementHolder($this->getParentFilter()->getScopes());
                $options = $model->$methodName($holder);
            }
        }

        if (!is_array($options)) {
            $options = [];
        }

View on GitHub (pinned to b608633a7e)

When it happens

Trigger: Thrown at modules/backend/filterwidgets/Group.php:281 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/c99bd605bc5125cc. Report an issue: GitHub.