{"record":{"id":"4ac2aa3d3e0a1703","repo":"yiisoft/yii2","slug":"method-is-not-supported","errorCode":null,"errorMessage":"{method} is not supported.","messagePattern":"(.+?) is not supported\\.","errorType":"exception","errorClass":"yii\\base\\NotSupportedException","httpStatus":null,"severity":"error","filePath":"framework/db/BaseActiveRecord.php","lineNumber":166,"sourceCode":"\n    /**\n     * Updates the whole table using the provided attribute values and conditions.\n     *\n     * For example, to change the status to be 1 for all customers whose status is 2:\n     *\n     * ```\n     * Customer::updateAll(['status' => 1], 'status = 2');\n     * ```\n     *\n     * @param array $attributes attribute values (name-value pairs) to be saved into the table\n     * @param string|array $condition the conditions that will be put in the WHERE part of the UPDATE SQL.\n     * Please refer to [[Query::where()]] on how to specify this parameter.\n     * @return int the number of rows updated\n     * @throws NotSupportedException if not overridden\n     */\n    public static function updateAll($attributes, $condition = '')\n    {\n        throw new NotSupportedException(__METHOD__ . ' is not supported.');\n    }\n\n    /**\n     * Updates the whole table using the provided counter changes and conditions.\n     *\n     * For example, to increment all customers' age by 1,\n     *\n     * ```\n     * Customer::updateAllCounters(['age' => 1]);\n     * ```\n     *\n     * @param array $counters the counters to be updated (attribute name => increment value).\n     * Use negative values if you want to decrement the counters.\n     * @param string|array $condition the conditions that will be put in the WHERE part of the UPDATE SQL.\n     * Please refer to [[Query::where()]] on how to specify this parameter.\n     * @return int the number of rows updated\n     * @throws NotSupportedException if not overrided\n     */","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/yiisoft/yii2/blob/66f00d18a29b520f85e8e8f1e32d1e7e7b556cac/framework/db/BaseActiveRecord.php#L148-L184","documentation":"BaseActiveRecord::updateAll() is a stub that throws NotSupportedException; storage-specific AR classes are expected to override it. yii\\db\\ActiveRecord overrides it with real SQL, so encountering this error means the class in the call chain extends BaseActiveRecord directly (custom or third-party AR) and never implemented the static batch-update method.","triggerScenarios":"Calling CustomModel::updateAll(['status' => 1], 'status = 2') on an AR subclass that extends BaseActiveRecord without overriding updateAll; batch-updating via a third-party AR wrapper that skipped the static methods.","commonSituations":"Custom AR implementations over APIs, files, or NoSQL stores; extending BaseActiveRecord while copying usage patterns from yii\\db\\ActiveRecord docs; save() paths that internally rely on static methods that were not implemented.","solutions":["Override updateAll($attributes, $condition = '') in your subclass with storage-specific batch logic","If the backing store is a SQL table, extend yii\\db\\ActiveRecord instead of BaseActiveRecord","If batch operations are impossible, loop over find() results and call instance-level update()/save()","Delegate bulk updates to the storage layer directly (query builder, bulk API) instead of the AR static"],"exampleFix":"// before\nclass FileUser extends \\yii\\db\\BaseActiveRecord { ... }\nFileUser::updateAll(['banned' => 1], 'id = 5'); // throws\n\n// after\nclass FileUser extends \\yii\\db\\BaseActiveRecord\n{\n    public static function updateAll($attributes, $condition = '')\n    {\n        // implement batch update against the file store, return affected count\n    }\n}","handlingStrategy":"try-catch","validationCode":"// guard: does this class actually implement the static batch update?\n$m = new ReflectionMethod($modelClass, 'updateAll');\nif ($m->getDeclaringClass()->getName() === yii\\db\\BaseActiveRecord::class) {\n    throw new LogicException(\"{$modelClass} does not implement updateAll().\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    $count = CustomModel::updateAll($attrs, $cond);\n} catch (yii\\base\\NotSupportedException $e) {\n    // degrade to per-record updates\n    $count = 0;\n    foreach (CustomModel::find()->where($cond)->all() as $m) {\n        $m->setAttributes($attrs);\n        $count += (int)$m->update(false);\n    }\n}","preventionTips":["Implement all three static batch methods (updateAll, updateAllCounters, deleteAll) in custom AR subclasses","Add abstract signatures or an interface checklist for storage-specific ARs","Smoke-test batch endpoints after introducing a new AR flavor"],"tags":["active-record","unsupported-operation","static-methods","batch-update"],"backgroundTag":"unsupported-operation","analyzedSha":"66f00d18a29b520f85e8e8f1e32d1e7e7b556cac","analyzedAt":"2026-08-17T05:17:23.470Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}