Shorthand access method to create collection. Consults aliases to allow short names.

@param string|Entity\Entity $className

@return ArrayCollection
766205
public function createCollection($className)
    {
        $className = (string) $className;
        if (array_key_exists($className, $this->aliases)) {
            $className = $this->aliases[$className];
        }

        return $this->getCollectionManager()->create($className);
    }
1328591
public function buildListEntityInterfaces(array $entityClassNames = [])
    {
        $listEntityInterfaces = [];

        $moduleOptionsManager = $this->getModuleOptionsPluginManager();
        $allowedModules = $this->getAllowedModules($entityClassNames);

        foreach ($entityClassNames as $entityClassName) {
            $r = new ReflectionClass($entityClassName);
            $useInterfaces = $r->getInterfaceNames();
            foreach ($useInterfaces as $currentInterface) {
                if ($moduleOptionsManager->hasModuleNameByClassName($currentInterface)) {
                    $moduleNameByInterface = $moduleOptionsManager->getModuleNameByClassName($currentInterface);
                    if (array_key_exists($moduleNameByInterface, $allowedModules)) {
                        $listEntityInterfaces[$currentInterface] = $currentInterface;
                    }
                }
            }
        }

        return $listEntityInterfaces;
    }
65725
public function getRepositories(array $entityNames)
    {
        $repositoryCollection = new EntityRepositoryCollection($this);
        foreach ($entityNames as $entityName) {
            $repositoryCollection->addRepository($this->getRepository($entityName));
        }
        return $repositoryCollection;
    }
915421
public function getCollection($collectionClass = CreateFromAttributesInterface::class)
    {
        $collection = [];
        if ($this->isSuccessful()) {
            $data = $this->getData();
            foreach ($data as $attributes) {
                /** @var AbstractModel $collectionClass */
                $collection[] = $collectionClass::createFromAttributes($attributes);
            }
        }

        return $collection;
    }
696656
protected static function getClassFromCollection( array $collection )
    {
        // Make sure everything in this container is of __exactly__ the same type.
        // This is a stronger check than the entity container performs (child entities are ok in the container)
        $classes = array_unique( array_map( 'get_class', $collection ) );

        if( count( $classes ) > 1 ) {
            // TODO this could fallback to persisting every entity individually. That would work.
            throw new \Exception(
                sprintf(
                    "Can't manage entities in a container with multiple types, these are %s.",
                    implode( ", ", $classes )
                )
            );
        }
        return array_pop( $classes );

    }
863537
public function getField(string $className): array
    {
        $joinsType = $this->types->getFilterGroupJoin($className);

        $joinsField = [
            'name' => 'joins',
            'description' => 'Optional joins to either filter the query or fetch related objects from DB in a single query',
            'type' => $joinsType,
        ];

        return $joinsField;
    }
908900
public function getMappedFirstEntitiesByEntityType($entityName)
    {
        $entities = [];
        foreach ($this->data as $data) {
            $entity = $this->createAndReturnNewFirstEntity($data, $entityName);
            if ($entity) {
                $entities[] = $entity;
            }
        }
        return $entities;
    }
934098
public function createClassConstantReference(string $className): ClassConstFetch
    {
        $nameNode = new FullyQualified($className);

        return $this->builderFactory->classConstFetch($nameNode, 'class');
    }
1334023
protected function getObjectReferences(ObjectManager $objectManager, $className)
    {
        $identifier = $objectManager->getClassMetadata($className)->getIdentifier();
        $idField    = reset($identifier);

        /** @var EntityRepository $objectRepository */
        $objectRepository = $objectManager->getRepository($className);

        $idsResult = $objectRepository
            ->createQueryBuilder('t')
            ->select('t.' . $idField)
            ->getQuery()
            ->getArrayResult();

        $ids = [];
        foreach ($idsResult as $result) {
            $ids[] = $result[$idField];
        }

        return $this->getObjectReferencesByIds($objectManager, $className, $ids);
    }
559415
public function findByCollectionNameIterator($collectionName)
    {
        /** @var QueryBuilder $queryBuilder */
        $queryBuilder = $this->entityManager->createQueryBuilder();
        return $queryBuilder
            ->select('PersistentResource')
            ->from($this->getEntityClassName(), 'PersistentResource')
            ->where('PersistentResource.collectionName = :collectionName')
            ->setParameter(':collectionName', $collectionName)
            ->getQuery()->iterate();
    }
90619
public function createCollection($name, array $options = null)
    {
        $classDefinition = $this->getCollectionDefinition($name);
        
        if (!empty($options)) {
            $classDefinition->merge($options);
        }

        $mongoCollection = $this->getMongoDB()->createCollection(
            $name,
            $classDefinition->getMongoCollectionOptions()
        );

        // create collection
        $className = $classDefinition->getClass();
        return new $className(
            $this,
            $mongoCollection,
            $classDefinition
        );
    }
246958
public function create($className)
    {
        $builder = new Builder($className, $this);
        $this->getGuesser()->fill($builder);
        return $builder;
    }
849649
public function getClassByName($className)
    {
        $classMap = $this->getClassMap($this->splitClassName($className)) . "[\"__class\"]";
        $return = null;

        eval(
            "if (isset(\$this->indexedClasses$classMap)) {"
            . " \$return = \$this->indexedClasses$classMap;"
            . "}"
        );

        return $return;
    }
826622
protected function getConstrainedDataAssociations(EntityManagerInterface $entityManager, $className)
    {
        // We must ensure that we check all the different classes in case of inheritance mapping
        /** @var ClassMetadata $sourceMetadata */
        $sourceMetadata = $entityManager->getClassMetadata($className);
        $classes = $sourceMetadata->parentClasses;
        $classes[] = $className;

        /** @var ClassMetadata[] $metadatas */
        $associationsToCheck = [];
        $metadatas = $entityManager->getMetadataFactory()->getAllMetadata();
        foreach ($metadatas as $metadata) {
            foreach ($metadata->getAssociationMappings() as $associationMapping) {
                foreach ($classes as $class) {
                    $this->checkAssociationMapping($class, $associationMapping, $associationsToCheck);
                }
            }
        }

        return $associationsToCheck;
    }
447979
private function generateEntity($className)	{
		$genClassName = EntityManager::PREFIX . str_replace("\\", "", $className) . "Entity";
		$table = EntityReflexion::getTable($className);
		if ($table === NULL) {
			throw new RepositoryException("Entity \"" . $className . " has no annotation \"table\"");
		} else {
			if (in_array($genClassName, $this->entities) || class_exists($genClassName)) {
				return;
			} else {
				$this->entities[$genClassName] = $genClassName;
				$class = $this->cache->load($genClassName);
				if ($class) {
					$repository = $class;
					$references = $this->getReferences($className);
					$this->generateReferences($references);
				} else {
					$repository = new ClassType($genClassName);
					$repository->addExtend($className);
					$repository->setFinal(TRUE);
					$repository->addComment($genClassName);
					$repository->addComment("@table " . $table);

					$columns = $this->getColumns($className);
					$this->generateGetters($columns, $repository);

					$references = $this->getReferences($className);
					$this->generateReferences($references, $repository);
					$this->generateAddMethods($references, $repository);
					$this->generateOverrides($repository);

					//FileSystem::write(WWW_DIR . '/temp/' . $genClassName . ".php", "<?php\n" . $repository);
					$this->cache->save($genClassName, $repository, array(
						Cache::FILES => EntityReflexion::getFile($className), // lze uvést i pole souborů
					));
				}
				if (!class_exists($genClassName)) {
					$res = eval('?><?php ' . $repository);
					if ($res === FALSE && ($error = error_get_last()) && $error['type'] === E_PARSE) {
						throw new \ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line']);
					}
				}
			}
		}
	}
59132
public function getDocumentCollection($className)
    {
        $className = ltrim($className, '\\');

        $metadata = $this->metadataFactory->getMetadataFor($className);
        $collectionName = $metadata->getCollection();

        if ( ! $collectionName) {
            throw MongoDBException::documentNotMappedToCollection($className);
        }

        if ( ! isset($this->documentCollections[$className])) {
            $db = $this->getDocumentDatabase($className);

            $this->documentCollections[$className] = $metadata->isFile()
                ? $db->getGridFS($collectionName)
                : $db->selectCollection($collectionName);
        }

        $collection = $this->documentCollections[$className];

        if ($metadata->slaveOkay !== null) {
            $collection->setSlaveOkay($metadata->slaveOkay);
        }

        return $this->documentCollections[$className];
    }
555602
private function getCollection(StreamName $streamName): Collection
    {
        $collection = $this->mongoClient->selectCollection($this->dbName, $this->getCollectionName($streamName));

        return $collection;
    }