-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ | |
use Doctrine\ORM\Mapping\ClassMetadataFactory; | ||
use Doctrine\ORM\Proxy\Autoloader; | ||
use Doctrine\Persistence\ManagerRegistry; | ||
use Faker\Factory as FakerFactory; | ||
use Faker\Generator as FakerGenerator; | ||
use Illuminate\Contracts\Container\Container; | ||
use Illuminate\Notifications\ChannelManager; | ||
use Illuminate\Support\ServiceProvider; | ||
|
@@ -31,6 +33,7 @@ | |
use LaravelDoctrine\ORM\Exceptions\ExtensionNotFound; | ||
use LaravelDoctrine\ORM\Extensions\ExtensionManager; | ||
use LaravelDoctrine\ORM\Notifications\DoctrineChannel; | ||
use LaravelDoctrine\ORM\Testing\Factory as EntityFactory; | ||
use LaravelDoctrine\ORM\Validation\PresenceVerifierProvider; | ||
|
||
use function assert; | ||
|
@@ -68,6 +71,7 @@ public function register(): void | |
$this->registerExtensions(); | ||
$this->registerConsoleCommands(); | ||
$this->registerCustomTypes(); | ||
$this->registerEntityFactory(); | ||
$this->registerProxyAutoloader(); | ||
|
||
if (! $this->shouldRegisterDoctrinePresenceValidator()) { | ||
|
@@ -270,6 +274,26 @@ public function extendNotificationChannel(): void | |
}); | ||
} | ||
|
||
/** | ||
* Register the Entity factory instance in the container. | ||
* | ||
* @return void | ||
Check failure on line 280 in src/DoctrineServiceProvider.php
|
||
*/ | ||
protected function registerEntityFactory(): void | ||
{ | ||
$this->app->singleton(FakerGenerator::class, function ($app) { | ||
return FakerFactory::create($app['config']->get('app.faker_locale', 'en_US')); | ||
}); | ||
|
||
$this->app->singleton(EntityFactory::class, function ($app) { | ||
return EntityFactory::construct( | ||
$app->make(FakerGenerator::class), | ||
$app->make('registry'), | ||
database_path('factories') | ||
Check failure on line 292 in src/DoctrineServiceProvider.php
|
||
); | ||
}); | ||
} | ||
|
||
/** | ||
* Register proxy autoloader | ||
*/ | ||
|