{@inheritDoc}
@see \n2n\persistence\meta\Database::createMetaEntityFactory()
@return MetaEntityFactory
771522
public function createMetaEntityFactory(): MetaEntityFactory {
		if (!isset($this->metaEntityFactory)) {
			$this->metaEntityFactory = new PgsqlMetaEntityFactory($this);
		}
		
		return $this->metaEntityFactory;
	}
476070
public function newInstance(ClassMetadata $class)
    {
        $entity = $this->instantiator->instantiate($class->getClassName());

        if ($entity instanceof EntityManagerAware) {
            $entity->injectEntityManager($this->em, $class);
        }

        return $entity;
    }
474368
public function getClassMetadataFactory()
    {
        if (!isset($this->attributes['classMetadataFactory'])) {
            $classMetaDataFactoryName = $this->getClassMetadataFactoryName();
            $this->attributes['classMetadataFactory'] = new $classMetaDataFactoryName;
        }
        return $this->attributes['classMetadataFactory'];
    }
459550
public function createMetaEntityFactory(): MetaEntityFactory {
		if (!$this->metaEntityFactory) {
			$this->metaEntityFactory = new MssqlMetaEntityFactory($this);
		}
		return $this->metaEntityFactory;
	}
73837
public static function create($conf = null)
    {
        self::$defaultConf = new FakerinoConf();
        self::$defaultConf->loadConfiguration();
        if ($conf !== null) {
            $confArray = $conf;
            if (!is_array($conf)) {
                $confTypeFactory = new FileConfigurationLoaderFactory(
                    $conf
                );
                $confParser = $confTypeFactory->load();
                $confArray = $confParser->toArray();
            }
            $conf = $confArray;
        }
        self::$defaultConf = new FakerinoConf($conf);
        self::$defaultConf->loadConfiguration();

        return new FakeDataFactory(self::getDefaultHandler(), new DoctrineLayer(self::getDatabaseConfig()), new TwigTemplate());
    }
371469
private function getMeta($create = false)
    {
        $locale = $this->locale;
        $metaCollection = $this->entity->getMeta();

        // get meta only with this locale
        $metaCollectionFiltered = $metaCollection->filter(
            function($meta) use ($locale) {
                /** @var CollectionMeta $meta */
                if ($meta->getLocale() == $locale) {
                    return true;
                }

                return false;
            }
        );

        // check if meta was found
        if ($metaCollectionFiltered->isEmpty()) {
            if ($create) {
                // create when not found
                $meta = new CollectionMeta();
                $meta->setLocale($this->locale);
                $meta->setCollection($this->entity);
                $this->entity->addMeta($meta);

                return $meta;
            }

            // return first when create false
            return $this->entity->getDefaultMeta();
        }

        // return exists
        return $metaCollectionFiltered->first();
    }
1046831
public function createFromEntity ($entity)
    {
        // Persist it
        $this->em->persist($entity);
        $this->em->flush();

        // Convert it to model and cache it
        $Model                  = $this->_convertEntityToModel($entity);
        $this->cache[$entity->getId()] = $Model;

        return $Model;
    }
962536
public function contextFactory(ContextFactory $instance = null, array $contexts = [])
    {
        if ($instance === null) {
            if ($this->_contextFactory === null) {
                $this->_contextFactory = ContextFactory::createWithDefaults($contexts);
            }

            return $this->_contextFactory;
        }
        $this->_contextFactory = $instance;

        return $this->_contextFactory;
    }
674791
public static function create($body, ?DescriptionFactory $descriptionFactory = null, ?Context $context = null): self
    {
        Assert::notNull($descriptionFactory);

        return new static($descriptionFactory->create($body, $context));
    }
1237073
public function toEntity(
        $entity,
        ResourceTransformer $resourceTransformer,
        PropertyResolver $propertyResolver,
        PropertySetter $propertySetter,
        EntityFactory $factory,
        Context $context
    ) {

    }
1141622
public function factory($documentClass, DocumentIdentity $identity = null)
    {
        if (!isset($this->prototypes[$documentClass])) {
            // create document
            $document = new $documentClass();

            // fire create event
            $event = new DocumentEvent($document);
            $this->dispatcher->dispatch(IndexerEvents::CREATE_DOCUMENT, $event);

            // cache prototype
            $this->prototypes[$documentClass] = $document;
        }

        $document = clone $this->prototypes[$documentClass];
        $document->set('_document_class', $documentClass);

        if ($identity) {
            $document->setIdentity($identity);
        }

        return $document;
    }
1151627
protected function buildEntityService(string $modelClass): IEntityService
    {
        try {
            if (isset($this->registeredServices[$modelClass])) {
                return $this->container->make($this->registeredServices[$modelClass]);
            }

            return $this->container->make(EntityService::class, [
                'className' => $modelClass,
                'repository' => $this->repositoryFactory->getRepository($modelClass),
            ]);
        } catch (RepositoryException $exception) {
            throw new EntityServiceException($exception->getMessage(), $exception->getCode(), $exception);
        }
    }
1343111
protected EntityDescFactory createEntityDescFactory() {
    Class<?> superclass = null;
    if (entityConfig.getSuperclassName() != null) {
      superclass = forName(entityConfig.getSuperclassName(), "superclassName");
    }
    return globalFactory.createEntityDescFactory(
        entityConfig.getPackageName(),
        superclass,
        entityPropertyDescFactory,
        entityConfig.getNamingType() == null
            ? NamingType.NONE
            : entityConfig.getNamingType().convertToEnum(),
        entityConfig.getOriginalStatesPropertyName(),
        entityConfig.isShowCatalogName(),
        entityConfig.isShowSchemaName(),
        entityConfig.isShowTableName(),
        entityConfig.isShowDbComment(),
        entityConfig.isUseAccessor(),
        entityConfig.isUseListener());
  }
1327678
public function factory()
    {

        // register additional annotation libraries
        foreach ($this->persistenceUnitNode->getAnnotationRegistries() as $annotationRegistry) {
            AnnotationRegistry::registerAutoloadNamespace(
                $annotationRegistry->getNamespace(),
                $annotationRegistry->getDirectoriesAsArray($this->application->getWebappPath())
            );
        }

        // globally ignore configured annotations to ignore
        foreach ($this->persistenceUnitNode->getIgnoredAnnotations() as $ignoredAnnotation) {
            AnnotationReader::addGlobalIgnoredName($ignoredAnnotation->getNodeValue()->__toString());
        }

        // load the metadata configuration
        $metadataConfiguration = $this->persistenceUnitNode->getMetadataConfiguration();

        // prepare the setup properties
        $absolutePaths = $metadataConfiguration->getDirectoriesAsArray($this->application->getWebappPath());
        $proxyDir = $metadataConfiguration->getParam(MetadataConfigurationInterface::PARAM_PROXY_DIR);
        $isDevMode = $metadataConfiguration->getParam(MetadataConfigurationInterface::PARAM_IS_DEV_MODE);
        $useSimpleAnnotationReader = $metadataConfiguration->getParam(MetadataConfigurationInterface::PARAM_USE_SIMPLE_ANNOTATION_READER);

        // load the factory method from the available mappings
        $factoryMethod = EntityManagerFactory::$metadataMapping[$metadataConfiguration->getType()];

        // create the database configuration and initialize the entity manager
        $configuration = Setup::$factoryMethod($absolutePaths, $isDevMode, $proxyDir, null, $useSimpleAnnotationReader);

        // load the datasource node
        $datasourceNode = null;
        foreach ($this->application->getInitialContext()->getSystemConfiguration()->getDatasources() as $datasourceNode) {
            if ($datasourceNode->getName() === $this->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',
                    $this->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',
                    $this->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',
                    $this->persistenceUnitNode->getName()
                )
            );
        }

        // initialize and return a entity manager decorator instance
        return new DoctrineEntityManagerDecorator(
            EntityManager::create(ConnectionUtil::get($this->application)->fromDatabaseNode($databaseNode), $configuration)
        );
    }
1153523
public function create()
    {
        $config = new Configuration();
        $config->setClassMetadataFactoryName(Mapping\ClassMetadataFactory::class);

        $eventManager = new EventManager();

        $flowAnnotationDriver = $this->objectManager->get(FlowAnnotationDriver::class);
        $config->setMetadataDriverImpl($flowAnnotationDriver);

        $proxyDirectory = Files::concatenatePaths([$this->environment->getPathToTemporaryDirectory(), 'Doctrine/Proxies']);
        Files::createDirectoryRecursively($proxyDirectory);
        $config->setProxyDir($proxyDirectory);
        $config->setProxyNamespace('Neos\Flow\Persistence\Doctrine\Proxies');
        $config->setAutoGenerateProxyClasses(false);

        // Set default host to 127.0.0.1 if there is no host configured but a dbname
        if (empty($this->settings['backendOptions']['host']) && !empty($this->settings['backendOptions']['dbname']) && empty($this->settings['backendOptions']['unix_socket'])) {
            $this->settings['backendOptions']['host'] = '127.0.0.1';
        }

        // The following code tries to connect first, if that succeeds, all is well. If not, the platform is fetched directly from the
        // driver - without version checks to the database server (to which no connection can be made) - and is added to the config
        // which is then used to create a new connection. This connection will then return the platform directly, without trying to
        // detect the version it runs on, which fails if no connection can be made. But the platform is used even if no connection can
        // be made, which was no problem with Doctrine DBAL 2.3. And then came version-aware drivers and platforms...
        $connection = DriverManager::getConnection($this->settings['backendOptions'], $config, $eventManager);
        try {
            $connection->connect();
        } catch (ConnectionException $exception) {
            $settings = $this->settings['backendOptions'];
            $settings['platform'] = $connection->getDriver()->getDatabasePlatform();
            $connection = DriverManager::getConnection($settings, $config, $eventManager);
        }

        $this->emitBeforeDoctrineEntityManagerCreation($connection, $config, $eventManager);
        $entityManager = EntityManager::create($connection, $config, $eventManager);
        $flowAnnotationDriver->setEntityManager($entityManager);
        $this->emitAfterDoctrineEntityManagerCreation($config, $entityManager);

        return $entityManager;
    }
217622
static function create( $contentObjectID, $userIdentifier, $creatorID = false )
    {
        $timestamp = time();

        if ( $creatorID === false )
        {
            $user = eZUser::currentUser();
            $creatorID = $user->id();
        }
        $row = array( 'contentobject_id' => $contentObjectID,
                      'user_identifier' => $userIdentifier,
                      'creator_id' => $creatorID,
                      'created' => $timestamp,
                      'modified' => $timestamp );
        return new eZInformationCollection( $row );
    }
749880
private function entityFactory()
    {
        // this is a little tortuous but some constructor flows require the EntityManager
        // as this point in the refactor I'm unwilling to modify the constructor of the Entity
        // TODO. Fix this. Constructor injection
        $entity = $this->reflEntityClass->newInstanceWithoutConstructor();
        // add the entityManager
        if( $this->reflEntityManagerPropertyOfEntity ) {
            $this->reflEntityManagerPropertyOfEntity->setValue($entity, $this->entityManager);
        }
        // call the original constructor
        call_user_func_array( [$entity, '__construct'], func_get_args() );
        return $entity;
    }