yiisoft/yii2 · error · yii\base\NotSupportedException
{method} is not supported.
Error message
{method} is not supported. What it means
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.
Source
Thrown at framework/db/BaseActiveRecord.php:166
/**
* Updates the whole table using the provided attribute values and conditions.
*
* For example, to change the status to be 1 for all customers whose status is 2:
*
* ```
* Customer::updateAll(['status' => 1], 'status = 2');
* ```
*
* @param array $attributes attribute values (name-value pairs) to be saved into the table
* @param string|array $condition the conditions that will be put in the WHERE part of the UPDATE SQL.
* Please refer to [[Query::where()]] on how to specify this parameter.
* @return int the number of rows updated
* @throws NotSupportedException if not overridden
*/
public static function updateAll($attributes, $condition = '')
{
throw new NotSupportedException(__METHOD__ . ' is not supported.');
}
/**
* Updates the whole table using the provided counter changes and conditions.
*
* For example, to increment all customers' age by 1,
*
* ```
* Customer::updateAllCounters(['age' => 1]);
* ```
*
* @param array $counters the counters to be updated (attribute name => increment value).
* Use negative values if you want to decrement the counters.
* @param string|array $condition the conditions that will be put in the WHERE part of the UPDATE SQL.
* Please refer to [[Query::where()]] on how to specify this parameter.
* @return int the number of rows updated
* @throws NotSupportedException if not overrided
*/View on GitHub (pinned to 66f00d18a2)
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
Example fix
// before
class FileUser extends \yii\db\BaseActiveRecord { ... }
FileUser::updateAll(['banned' => 1], 'id = 5'); // throws
// after
class FileUser extends \yii\db\BaseActiveRecord
{
public static function updateAll($attributes, $condition = '')
{
// implement batch update against the file store, return affected count
}
} Defensive patterns
Strategy: try-catch
Validate before calling
// guard: does this class actually implement the static batch update?
$m = new ReflectionMethod($modelClass, 'updateAll');
if ($m->getDeclaringClass()->getName() === yii\db\BaseActiveRecord::class) {
throw new LogicException("{$modelClass} does not implement updateAll().");
} Try / catch
try {
$count = CustomModel::updateAll($attrs, $cond);
} catch (yii\base\NotSupportedException $e) {
// degrade to per-record updates
$count = 0;
foreach (CustomModel::find()->where($cond)->all() as $m) {
$m->setAttributes($attrs);
$count += (int)$m->update(false);
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Primary key of '{$class}' can not be empty.
- "{}" must have a primary key.
- Key "{}" is not a column name and can not be used as a filte
- Invalid link: it must be an array of key-value pairs.
- "{class}" must have a primary key.
AI-assisted analysis of yiisoft/yii2@66f00d18a2 (2026-08-17).
Data as JSON: /api/errors/4ac2aa3d3e0a1703.
Report an issue: GitHub.