refactoring

This commit is contained in:
Yuri Kuznetsov
2021-07-27 17:01:48 +03:00
parent a24bf2d1d7
commit d83d3982cd
@@ -29,6 +29,9 @@
namespace Espo\Core\ORM;
use Espo\Core\Binding\BindingContainerBuilder;
use Espo\Core\Binding\ContextualBinder;
use Espo\Core\{
InjectableFactory,
Utils\ClassFinder,
@@ -75,9 +78,18 @@ class RepositoryFactory implements RepositoryFactoryInterface
$className = $this->defaultClassName;
}
return $this->injectableFactory->createWith($className, [
'entityFactory' => $this->entityFactory,
'entityType' => $entityType,
]);
return $this->injectableFactory->createWithBinding(
$className,
BindingContainerBuilder::create()
->bindInstance(EntityFactoryInteface::class, $this->entityFactory)
->bindInstance(EntityFactory::class, $this->entityFactory)
->inContext(
$className,
function (ContextualBinder $binder) use ($entityType) {
$binder->bindValue('$entityType', $entityType);
}
)
->build()
);
}
}