{"record":{"id":"d17ea1abf2db8b82","repo":"phalcon/cphalcon","slug":"the-option-field-is-required-d17ea1","errorCode":null,"errorMessage":"The option 'field' is required","messagePattern":"The option 'field' is required","errorType":"exception","errorClass":"Phalcon\\Mvc\\Model\\Behavior\\Exceptions\\MissingRequiredOption","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Model/Behavior/Timestampable.zep","lineNumber":51,"sourceCode":"\n        /**\n         * Check if the developer decided to take action here\n         */\n        if this->mustTakeAction(type) !== true {\n            return null;\n        }\n\n        let options = this->getOptions(type);\n\n        if typeof options != \"array\" {\n            return;\n        }\n\n        /**\n         * The field name is required in this behavior\n         */\n        if unlikely !fetch field, options[\"field\"] {\n            throw new MissingRequiredOption(\"field\");\n        }\n\n        let timestamp = this->getTimestamp(options);\n\n        /**\n         * Assign the value to the field, use writeAttribute() if the property\n         * is protected\n         */\n        if unlikely typeof field == \"array\" {\n            for singleField in field {\n                model->writeAttribute(singleField, timestamp);\n            }\n        } else {\n            model->writeAttribute(field, timestamp);\n        }\n    }\n\n    private function getTimestamp(array options)","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Model/Behavior/Timestampable.zep#L33-L69","documentation":"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.","triggerScenarios":"Thrown at phalcon/Mvc/Model/Behavior/Timestampable.zep:51 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add 'field' => 'created_at' (the target attribute) to the behavior options","Ensure the attribute exists on the model using the behavior"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","contentChangedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}