Skip to content

Commit

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

* Explain why DI fails sometimes and how to fix this (yiisoft#20010)

* Explain why AR does not support DI by default and how to support it (yiisoft#20010)
  • Loading branch information
skepticspriggan committed Mar 23, 2024
1 parent 2a76705 commit 5b0516c
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 5b0516c

Please sign in to comment.