Skip to content

v2.4.3

@houaiai houaiai tagged this 06 Mar 05:41
- Implemented think-orm 4.0 recommended approach using setOption()
- Moved model configuration to initialize() method
- Prevents model data pollution issues

1. WeakMap initialization errors
2. array_search type errors
3. Table name configuration (rule_model vs casbin_rule)

Direct property assignment ($this->property = value) in think-orm 4.0
causes model data pollution and WeakMap errors.

Following official think-orm 4.0 upgrade guide:
```php
protected function initialize(): void
{
    parent::initialize();
    $this->setOption('connection', $config);
    $this->setOption('table', $table);
    $this->setOption('name', $name);
}
```

Reference: https://doc.thinkphp.cn/@think-orm/v4_0/upgrade.html

Quote from docs:
"如果需要在模型内获取或设置模型属性的话改为使用模型的getOption或setOption方法"

- ✅ think-orm 2.0.53+
- ✅ think-orm 3.x
- ✅ think-orm 4.0+ (recommended approach)

This release follows think-orm 4.0 best practices.
Fully backward compatible with previous versions.
Assets 2
Loading