octobercms/october · error · ApplicationException
Model ':class' does not contain a method ':method'.
Error message
Model ':class' does not contain a method ':method'.
What it means
Thrown by LegacyDataTable's getLegacyDataTableOptions when a dropdown/autocomplete column in the DataTable config names a model method that does not exist on the model class. The legacy options callback resolves per-column option methods, and the lookup for the column's declared method failed.
Solutions
- Add the declared method to the model class returning dropdown options
- Correct the method name configured for that column in the datatable field config
- Replace the legacy callback approach with the Table widget's native options resolution if migrating
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at modules/backend/formwidgets/datatable/LegacyDataTable.php:113 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/ab61e28ecfff8cb9.
Report an issue: GitHub.
Appendix: source
Thrown at modules/backend/formwidgets/datatable/LegacyDataTable.php:113
$config->alias = studly_case(HtmlHelper::nameToId($fieldName)) . 'datatable';
$config->fieldName = $fieldName;
$table = new Table($this->controller, $config);
$table->bindEvent('table.getDropdownOptions', [$this, 'getLegacyDataTableOptions']);
$table->bindEvent('table.getAutocompleteOptions', [$this, 'getLegacyDataTableOptions']);
return $table;
}
/**
* getLegacyDataTableOptions is the legacy dropdown/autocomplete option callback handler
*/
public function getLegacyDataTableOptions($columnName, $rowData)
{
$methodName = 'get' . studly_case($this->fieldName) . 'DataTableOptions';
if (!$this->model->methodExists($methodName) && !$this->model->methodExists('getDataTableOptions')) {
throw new ApplicationException(
Lang::get(
'backend::lang.model.missing_method',
[
'class' => get_class($this->model),
'method' => 'getDataTableOptions'
]
)
);
}
if ($this->model->methodExists($methodName)) {
$result = $this->model->$methodName($columnName, $rowData);
}
else {
$result = $this->model->getDataTableOptions($this->fieldName, $columnName, $rowData);
}
if (!is_array($result)) {View on GitHub (pinned to b608633a7e)