#780·orm

How to properly use nette/di lazy feature with nextras/orm

Author: mrceperkaCreated Nov 12, 2025Updated Nov 19, 2025

We've come up with solution that works but it required more steps then we expected.

First, you set nette/di lazy to true

neon
di:
  lazy: true

Then you have to force nextras/orm extension to initializeMetadata

neon
orm:
    model: App\Core\Model\Orm
    initializeMetadata: true

Then you also HAVE TO DISABLE lazy for orm.metadataStorage

neon
orm.metadataStorage
    lazy: false

Aaand it probably works, bit complicated setup tho :D

Is there any better way right know? Thanks