config = $config; $this->injectableFactory = $injectableFactory; $this->ormMetadata = $ormMetadata; } public function load() { $entityFactory = $this->injectableFactory->create(EntityFactory::class); $repositoryFactory = $this->injectableFactory->createWith(RepositoryFactory::class, [ 'entityFactory' => $entityFactory, ]); $helper = $this->injectableFactory->create(Helper::class); $config = $this->config; $params = [ 'metadata' => $this->ormMetadata->getData(), 'host' => $config->get('database.host'), 'port' => $config->get('database.port'), 'dbname' => $config->get('database.dbname'), 'user' => $config->get('database.user'), 'charset' => $config->get('database.charset', 'utf8'), 'password' => $config->get('database.password'), 'driver' => $config->get('database.driver'), 'platform' => $config->get('database.platform'), 'sslCA' => $config->get('database.sslCA'), 'sslCert' => $config->get('database.sslCert'), 'sslKey' => $config->get('database.sslKey'), 'sslCAPath' => $config->get('database.sslCAPath'), 'sslCipher' => $config->get('database.sslCipher'), ]; $entityManager = $this->injectableFactory->createWith(EntityManagerService::class, [ 'params' => $params, 'repositoryFactory' => $repositoryFactory, 'entityFactory' => $entityFactory, 'helper' => $helper, ]); return $entityManager; } }