phalcon/cphalcon · error · Phalcon\Mvc\Model\Behavior\Exceptions\MissingRequiredOption
The option 'field' is required
Error message
The option 'field' is required
What it means
Thrown inside Timestampable::notify when the behavior fires for the current event type but its options array for that type lacks the mandatory 'field' key. The behavior must know which model field to write the generated timestamp into; fetch of options['field'] failing means the behavior was configured without it, so the sentinel MissingRequiredOption error names 'field' as the missing configuration entry.
Solutions
- Add 'field' => 'created_at' (the target attribute) to the behavior options
- Ensure the attribute exists on the model using the behavior
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at phalcon/Mvc/Model/Behavior/Timestampable.zep:51 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21).
Data as JSON: /api/errors/d17ea1abf2db8b82.
Report an issue: GitHub.
Appendix: source
Thrown at phalcon/Mvc/Model/Behavior/Timestampable.zep:51
/**
* Check if the developer decided to take action here
*/
if this->mustTakeAction(type) !== true {
return null;
}
let options = this->getOptions(type);
if typeof options != "array" {
return;
}
/**
* The field name is required in this behavior
*/
if unlikely !fetch field, options["field"] {
throw new MissingRequiredOption("field");
}
let timestamp = this->getTimestamp(options);
/**
* Assign the value to the field, use writeAttribute() if the property
* is protected
*/
if unlikely typeof field == "array" {
for singleField in field {
model->writeAttribute(singleField, timestamp);
}
} else {
model->writeAttribute(field, timestamp);
}
}
private function getTimestamp(array options)View on GitHub (pinned to b7419de9cd)