Skip to content

Commit

Permalink
feat: Ability to change reload strategy from AutoMapper::create()
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMeshok committed Sep 4, 2024
1 parent 8fa3035 commit 3fce8e6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/AutoMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use AutoMapper\Loader\ClassLoaderInterface;
use AutoMapper\Loader\EvalLoader;
use AutoMapper\Loader\FileLoader;
use AutoMapper\Loader\FileReloadStrategy;
use AutoMapper\Metadata\MetadataFactory;
use AutoMapper\Metadata\MetadataRegistry;
use AutoMapper\Provider\ProviderInterface;
Expand Down Expand Up @@ -132,6 +133,7 @@ public static function create(
ExpressionLanguageProvider $expressionLanguageProvider = null,
EventDispatcherInterface $eventDispatcher = new EventDispatcher(),
iterable $providers = [],
FileReloadStrategy $reloadStrategy = FileReloadStrategy::ON_CHANGE,
): AutoMapperInterface {
if (\count($transformerFactories) > 0) {
trigger_deprecation('jolicode/automapper', '9.0', 'The "$transformerFactories" property will be removed in version 10.0, AST transformer factories must be included within AutoMapper.', __METHOD__);
Expand Down Expand Up @@ -188,7 +190,7 @@ public static function create(
if (null === $cacheDirectory) {
$loader = new EvalLoader($mapperGenerator, $metadataFactory);
} else {
$loader = new FileLoader($mapperGenerator, $metadataFactory, $cacheDirectory, $lockFactory);
$loader = new FileLoader($mapperGenerator, $metadataFactory, $cacheDirectory, $lockFactory, $reloadStrategy);
}

return new self($loader, $customTransformerRegistry, $metadataRegistry, $providerRegistry, $expressionLanguageProvider);
Expand Down

0 comments on commit 3fce8e6

Please sign in to comment.