diff --git a/src/Codeception/Module/Doctrine2.php b/src/Codeception/Module/Doctrine2.php index 3b838f5..669b58f 100644 --- a/src/Codeception/Module/Doctrine2.php +++ b/src/Codeception/Module/Doctrine2.php @@ -88,6 +88,24 @@ * purge_mode: 1 # 1: DELETE (=default), 2: TRUNCATE * ``` * + * ## Grabbing Entities with Symfony + * + * For Symfony users, the recommended way to query for entities is not to use this module's `grab...()` methods, but rather + * "inject" Doctrine's repository: + * + * ```php + * public function _before(FunctionalTester $I): void + * { + * $this->fooRepository = $I->grabService(FooRepository::class); + * } + * ``` + * + * Now you have access to all your familiar repository methods in your tests, e.g.: + * + * ```php + * $greenFoo = $this->fooRepository->findOneBy(['color' => 'green']); + * ``` + * * ## Public Properties * * * `em` - Entity Manager