Factory method for the EntityPool

@return RepositoryPoolInterface
328547
public function createPool()
    {
        $pool = new RepositoryPool();

        foreach ($this->definitions as $definition) {
            $pool->addRepositoryDefinition($definition);
        }

        return $pool;
    }
1039290
public function persist(ModelInterface $model): RepositoryInterface
    {
        $id = $model->getId();
        $row = $model->toPersistence();

        $this->connection->beginTransaction();

        $alreadyExists = (bool) $this->find($id);

        $stack = new RelatedModelManipulationStack();

        foreach ($row as $field => $value) {
            if ($value instanceof ModelCollectionInterface) {
                $stack->addToRemoveModels($value->getInitialModels());
                $stack->addToPersistModels($value->getModels());
                unset($row[$field]);
            } elseif ($value instanceof ModelReferenceInterface) {
                $row[$field.'Id'] = $this->persistModelReference($value, $stack);

                unset($row[$field]);
            }
        }

        if (!$alreadyExists) {
            $this->insert($id, $row);
        } else {
            $this->update($id, $row);
        }

        $this->removeRelatedModels($stack->getToRemoveModels());
        $this->persistRelatedModels($stack->getToPersistModels());

        $this->storageCache->set($id, $row);

        $this->connection->commit();

        return $this;
    }
453317
protected function getRepositoryUrlCache()
    {
        $repositoryUrlCache = $this->getSession()->get(SessionParameter::REPOSITORY_URL_CACHE);
        if ($repositoryUrlCache === null) {
            $repositoryUrlCache = new RepositoryUrlCache();
            $this->getSession()->put(SessionParameter::REPOSITORY_URL_CACHE, $repositoryUrlCache);
        }

        return $repositoryUrlCache;
    }
1321296
public function createMetaEntityFactory(): MetaEntityFactory {
		if (!(isset($this->metaEntityFactory))) {
			$this->metaEntityFactory = new OracleMetaEntityFactory($this);
		}
		return $this->metaEntityFactory;
	}
645995
protected function _repository()
    {
        $source = $this->getSource();
        if ($source === null) {
            list(, $class) = namespaceSplit(get_class($this));
            $source = Inflector::pluralize($class);
        }

        return TableRegistry::getTableLocator()->get($source);
    }
185267
public function factory()
    {

        // load the application and persistence unit configuration
        $application = $this->getApplication();
        $persistenceUnitNode = $this->getPersistenceUnitNode();

        // create a new Doctrine ORM configuration instance
        $configuration = $this->createConfiguration();

        // query whether or not an initialize EM configuration is available
        if ($application->hasAttribute($persistenceUnitNode->getName()) === false) {
            // globally ignore configured annotations to ignore
            foreach ($persistenceUnitNode->getIgnoredAnnotations() as $ignoredAnnotation) {
                AnnotationReader::addGlobalIgnoredName($ignoredAnnotation->getNodeValue()->__toString());
            }

            // load the datasource node
            $datasourceNode = null;
            foreach ($application->getInitialContext()->getSystemConfiguration()->getDatasources() as $datasourceNode) {
                if ($datasourceNode->getName() === $persistenceUnitNode->getDatasource()->getName()) {
                    break;
                }
            }

            // throw a exception if the configured datasource is NOT available
            if ($datasourceNode == null) {
                throw new \Exception(sprintf('Can\'t find a datasource node for persistence unit %s', $persistenceUnitNode->getName()));
            }

            // load the database node
            $databaseNode = $datasourceNode->getDatabase();

            // throw an exception if the configured database is NOT available
            if ($databaseNode == null) {
                throw new \Exception(sprintf('Can\'t find database node for persistence unit %s', $persistenceUnitNode->getName()));
            }

            // load the driver node
            $driverNode = $databaseNode->getDriver();

            // throw an exception if the configured driver is NOT available
            if ($driverNode == null) {
                throw new \Exception(sprintf('Can\'t find driver node for persistence unit %s', $persistenceUnitNode->getName()));
            }

            // load the connection parameters
            $connectionParameters = ConnectionUtil::get($application)->fromDatabaseNode($databaseNode);

            // append the initialized EM configuration to the application
            $application->setAttribute($persistenceUnitNode->getName(), array($connectionParameters, $configuration));
        }

        // load the initialized EM configuration from the application
        list ($connectionParameters, $configuration) = $application->getAttribute($persistenceUnitNode->getName());

        // initialize and return a entity manager decorator instance
        return new DoctrineEntityManagerDecorator(EntityManager::create($connectionParameters, $configuration));
    }
794992
protected function makeNewContainer()
    {
        $container = new Container();
        $container->classSet($this->entityClass);
        $container->setPropertyMapper( PropertyMapperEntityData::class );
        return $container;
    }
45821
private function buildFactory() {
        $this->getObject()->addUse(get_class($this->getModel()).' as Model');
        $method = new Object\Method();
        $method->setDescription('When called, this should return a new entity');
        $method->setReturnType('Model');
        $method->setAccess('public');
        $method->setName('generateEntity');
        $method->setContent('return $this->getDI()->get(Model::class);');
        $this->getObject()->addMethod($method);
    }
1143623
protected function createObjectFactory()
    {
        try {
            if (isset($this->parameters[SessionParameter::OBJECT_FACTORY_CLASS])) {
                $objectFactoryClass = new $this->parameters[SessionParameter::OBJECT_FACTORY_CLASS];
            } else {
                $objectFactoryClass = $this->createDefaultObjectFactoryInstance();
            }

            if (!($objectFactoryClass instanceof ObjectFactoryInterface)) {
                throw new \RuntimeException('Class does not implement ObjectFactoryInterface!', 1408354119);
            }

            $objectFactoryClass->initialize($this, $this->parameters);

            return $objectFactoryClass;
        } catch (\Exception $exception) {
            throw new \RuntimeException(
                'Unable to create object factory: ' . $exception,
                1408354120
            );
        }
    }
76530
protected function cachePool()
    {
        if (!isset($this->cachePool)) {
            throw new RuntimeException(sprintf(
                'Cache Pool is not defined for "%s"',
                get_class($this)
            ));
        }

        return $this->cachePool;
    }
271593
public function create()
    {
        if ($this->reflectionService !== null) {
            return $this->reflectionService;
        }

        $cacheManager = $this->bootstrap->getEarlyInstance(CacheManager::class);
        $configurationManager = $this->bootstrap->getEarlyInstance(ConfigurationManager::class);
        $settings = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow');

        $reflectionService = new ReflectionService();
        $reflectionService->injectLogger($this->bootstrap->getEarlyInstance(PsrLoggerFactoryInterface::class)->get('systemLogger'));
        $reflectionService->injectSettings($settings);
        $reflectionService->injectPackageManager($this->bootstrap->getEarlyInstance(PackageManager::class));
        $reflectionService->setStatusCache($cacheManager->getCache('Flow_Reflection_Status'));
        $reflectionService->setReflectionDataCompiletimeCache($cacheManager->getCache('Flow_Reflection_CompiletimeData'));
        $reflectionService->setReflectionDataRuntimeCache($cacheManager->getCache('Flow_Reflection_RuntimeData'));
        $reflectionService->setClassSchemataRuntimeCache($cacheManager->getCache('Flow_Reflection_RuntimeClassSchemata'));
        $reflectionService->injectEnvironment($this->bootstrap->getEarlyInstance(Environment::class));

        $this->reflectionService = $reflectionService;
        return $reflectionService;
    }
633408
private function _getRequestPool(): Pool
    {
        return new Pool($this->_getClient(), $this->_getRequestPromise(), [
            'concurrency' => max(1, $this->configOfConcurrency),
            'fulfilled' => function () {
                call_user_func_array([$this, '_responseSuccessHandle'], func_get_args());
            },
            'rejected' => function () {
                call_user_func_array([$this, '_responseFailHandle'], func_get_args());
            }
        ]);
    }
106374
public function makeModel()
    {
        $model = $this->app->make($this->model());

        if (!$model instanceof Model) {
            throw new RepositoryException("Class {$this->model()} must be an instance of Illuminate\\Database\\Eloquent\\Model");
        }

        $this->model = $model->with($this->withRelationShips());

        return $model;
    }
500668
protected function getRepository()
    {
        if ($this->repository === null) {
            $this->repository = $this->container->get('models')->getRepository(Customer::class);
        }
        return $this->repository;
    }
549900
public function getReferenceRepository()
    {
        if ( ! $this->referenceRepository) {
            $this->referenceRepository = new ProxyReferenceRepository($this->entityManager);
        }

        return $this->referenceRepository;
    }
85874
protected function batchFactory()
    {
        return new WriteBatch(
            $this->connection,
            $this->valueMapper,
            $this->databaseFromName($this->name)
        );
    }
706816
public function factory()
    {
        $method = $class = null;
        $class = __NAMESPACE__.'\\'.$this->drivers[$this->config['driver']];

        $name = $this->getName();
        if ($name != 'cygnite-session' && !is_null($this->cacheLimiter())) {
            $session = new $class($name, $this->cacheLimiter(), $this);
        } else {
            $session = new $class($this->name, null, $this);
        }

        return $session;
    }