mirror of
https://github.com/doctrine/data-fixtures.git
synced 2026-03-23 22:32:13 +01:00
Merge pull request #585 from greg0ire/use-nlz-odm
Use Native Lazy Objects with ODM when possible
This commit is contained in:
@@ -18,6 +18,8 @@ use function class_exists;
|
||||
use function dirname;
|
||||
use function method_exists;
|
||||
|
||||
use const PHP_VERSION_ID;
|
||||
|
||||
class MongoDBPurgerTest extends BaseTestCase
|
||||
{
|
||||
public const TEST_DOCUMENT_ROLE = Role::class;
|
||||
@@ -37,6 +39,11 @@ class MongoDBPurgerTest extends BaseTestCase
|
||||
$config->setHydratorNamespace('Hydrators');
|
||||
$config->setMetadataDriverImpl(AnnotationDriver::create(dirname(__DIR__) . '/TestDocument'));
|
||||
|
||||
/** @phpstan-ignore function.alreadyNarrowedType (that method exists only since ODM 2.14.0) */
|
||||
if (PHP_VERSION_ID >= 80400 && method_exists($config, 'setUseNativeLazyObject')) {
|
||||
$config->setUseNativeLazyObject(true);
|
||||
}
|
||||
|
||||
$dm = DocumentManager::create(null, $config);
|
||||
|
||||
$this->skipIfMongoDBUnavailable($dm);
|
||||
|
||||
Reference in New Issue
Block a user