Skip to content

Commit

Permalink
Explain why DI fails sometimes and how to fix this (#20010) (#20108)
Browse files Browse the repository at this point in the history
* Explain why DI fails sometimes and how to fix this (#20010)

* Explain why AR does not support DI by default and how to support it (#20010)
  • Loading branch information
skepticspriggan authored Feb 16, 2024
1 parent 0027227 commit c2e0485
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/guide/db-active-record.md
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,17 @@ life cycle will happen:
> - [[yii\db\ActiveRecord::updateCounters()]]
> - [[yii\db\ActiveRecord::updateAllCounters()]]
> Note: DI is not supported by default due to performance concerns. You can add support if needed by overriding
> the [[yii\db\ActiveRecord::instantiate()|instantiate()]] method to instantiate the class via [[Yii::createObject()]]:
>
> ```php
> public static function instantiate($row)
> {
> return Yii::createObject(static::class);
> }
> ```
### Refreshing Data Life Cycle <span id="refreshing-data-life-cycle"></span>
When calling [[yii\db\ActiveRecord::refresh()|refresh()]] to refresh an Active Record instance, the
Expand Down

0 comments on commit c2e0485

Please sign in to comment.